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

qa for deployer bug #1

Open
wants to merge 198 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
90ee27f
feat: claim permit in gift cards
EresDev Apr 23, 2024
5426f77
refactor: move addresses to constants from env
EresDev May 13, 2024
e0a787b
fix: compares owner address case insensitive
EresDev May 13, 2024
7a61714
fix: deduct fee from reward amount
EresDev May 13, 2024
abf145f
fix: show unavailable range cards price correctly
EresDev May 13, 2024
2aada64
refactor: rename func to clear its effect
EresDev May 13, 2024
52c0979
fix: use correct pricing for gift card
EresDev May 16, 2024
f1d58c3
refactor: move pricing & duplicatre code to proper files/vars
EresDev May 16, 2024
9ebe8f0
fix: offer only visa & mastercard
EresDev May 16, 2024
47e644e
fix: add disclaimer below gift cards list
EresDev May 16, 2024
56cba03
docs: add info about API base url
EresDev May 16, 2024
cf21902
fix: allow only ERC20 permit to claim card
EresDev May 16, 2024
f056b9d
fix: prevent large prices to take second line on cards list
EresDev May 16, 2024
ed6c28e
chore: run missing yarn install from previous merge
EresDev May 16, 2024
afe5f9e
chore: handle cspell warnings by listing & fixing words
EresDev May 16, 2024
84763f3
refactor: replace word usage product with gift-card
EresDev May 16, 2024
8d18bba
fix: check permit transfers correct erc20 token on claim gift card
EresDev May 17, 2024
7cc3fc5
fix: check permit token owner is correct on claim gift card
EresDev May 17, 2024
8fe9b2b
fix: validate correct token transfer on different chains
EresDev May 17, 2024
83b816a
refactor: allow tests to generate permits without CLI
EresDev May 21, 2024
bd17ddb
fix: show price/value upto 2 decimals in title
EresDev May 21, 2024
eff0545
test: add tests for claiming gift cards
EresDev May 21, 2024
d12b9bb
fix: add date filter to retrieve old order
EresDev May 22, 2024
0e909ec
test: ignore balance because it changes with tests
EresDev May 22, 2024
082f52b
chore: fix spell
EresDev May 22, 2024
678ca44
fix: run wrangler in workflow for backend in tests
EresDev May 23, 2024
e28ac13
fix: use reloadly sandbox by default
EresDev May 23, 2024
5dee0f7
fix: log if using reloadly sandbox or not
EresDev May 23, 2024
c16253d
fix: change anvil RPC to fork for tests
EresDev May 23, 2024
530f3d1
fix: start wrangler in action for tests backend
EresDev May 23, 2024
fa20756
fix: only show visa & mastercard
EresDev May 23, 2024
878d7cb
test: buy minimum available visa or mastercard
EresDev May 23, 2024
ae9b341
test: reveal code of already claimed visa
EresDev May 23, 2024
d4f8be2
fix: remove fixed chainId from test for gift card claim
EresDev May 23, 2024
926e9f1
fix: wait 2 sec for page to laod in test
EresDev May 23, 2024
3212a26
fix: remove invalid expectation from test
EresDev May 23, 2024
9f770ae
test: extract interceptors to remove duplication
EresDev May 24, 2024
cf608e5
refactor: rename var
EresDev May 24, 2024
e695cac
test: make claim gift card test more reliable
EresDev May 24, 2024
238aae3
fix: return 404 if order not found insteaf of 500
EresDev May 24, 2024
0ed7b52
refactor: change types to interfaces
EresDev May 25, 2024
4de57e0
refactor: rename interface
EresDev May 25, 2024
20c830d
refactor: replace types with interfaces
EresDev May 25, 2024
2e3d5e9
fix: align gift cards to center when less than 3
EresDev May 25, 2024
1963c65
fix: remove unnecessary text
EresDev May 25, 2024
1bd43f1
fix: inform properly when gift card unavailable
EresDev May 25, 2024
d5503a0
refactor: load visa & mastercard concurrently
EresDev May 25, 2024
2cfabc9
fix: reload gift cards when next/prev permit loads
EresDev May 25, 2024
b09fb16
fix: use websocket rpc for faster & reliable tests
EresDev May 25, 2024
1bb6211
fix: improve light mode support for gift cards
EresDev May 25, 2024
344befd
fix: separate matching & available price
EresDev May 25, 2024
8736d1a
refactor: rename function
EresDev May 25, 2024
376c9f2
fix: show gift card loader on page load
EresDev May 25, 2024
56d7a95
fix: await before printing in erc20 permit gen
EresDev May 25, 2024
f9b16c0
chore: use wrangler to server UI & backend
EresDev May 25, 2024
8fa0b09
chore: add gnosischain to accepted words in cspell
EresDev May 25, 2024
c0e71f7
chore: remove tenderly rpc
EresDev May 27, 2024
3c056ca
chore: show mastercard before visa cards
EresDev May 27, 2024
de33f42
fix: prevent exception on zero value
EresDev May 27, 2024
acec598
fix: reuse existing permit health check
EresDev May 27, 2024
1d89eea
fix: make the height of card img fixed to align
EresDev May 27, 2024
8cce139
fix: check of negative status to fail an order
EresDev May 27, 2024
ec7292a
fix: make redeem code visible as case sensitive & wrapped
EresDev May 27, 2024
4fb3568
fix: improve order processing messages
EresDev May 27, 2024
76916a3
test: update gift card order msgs assertions
EresDev May 27, 2024
77c1cbf
Merge branch 'development' of https://github.com/ubiquity/pay.ubq.fi …
EresDev May 27, 2024
1135a4f
chore: run missed yarn install from previous merge
EresDev May 31, 2024
214f730
refactor: change arrow functions to named functions
EresDev May 31, 2024
ae48f8a
refactor: reduce function complexity
EresDev May 31, 2024
7732866
refactor: replace string concatination with array push
EresDev May 31, 2024
70381cc
refactor: move disclaimer to static html
EresDev May 31, 2024
2a2325a
refactor: utilize run-s to run seq start scripts
EresDev May 31, 2024
5ae08db
refactor: shorten the variable name
EresDev May 31, 2024
4ec8c66
fix: use fastest rpc from @ubiquity-dao/rpc-handler
EresDev Jun 3, 2024
c4b1d6b
fix: fork anvil network from fastest rpc
EresDev Jun 3, 2024
76daaba
fix: prevent nonce collision on fund
EresDev Jun 3, 2024
222bd0c
refactor: remove unnecessary & error-prone code
EresDev Jun 3, 2024
68dfa23
fix: use new cloudflare deploy action
EresDev Jun 8, 2024
a29fe52
Merge branch 'development' of https://github.com/ubiquity/pay.ubq.fi …
EresDev Jun 17, 2024
d41e510
fix: show purchased gift card without page reload
EresDev Jun 17, 2024
54d5bb9
fix: add 'blockscan' to cspell words list
EresDev Jun 17, 2024
c7d44c9
fix: use correct env vars
EresDev Jun 17, 2024
0495045
fix: update test expected message
EresDev Jun 17, 2024
c275979
fix: remove permit signer check
EresDev Jun 17, 2024
48fa5d0
Merge pull request #226 from EresDevOrg/development
EresDev Jun 17, 2024
bf3b115
chore: bump deploy
0x4007 Jun 18, 2024
8b8fead
fix: trigger first deploy of beta branch
EresDev Jun 18, 2024
a769fc6
fix: remove push deploy trigger
EresDev Jun 18, 2024
e5fdf1d
chore: bump deploy
0x4007 Jun 19, 2024
7291d13
chore: merge conflicts
0x4007 Jul 17, 2024
f6b7278
fix: resolve footer conflict
EresDev Jul 17, 2024
743aac2
fix: change sandbox env var to string
EresDev Jul 17, 2024
54474af
Merge remote-tracking branch 'upstream/development' into beta
0x4007 Jul 18, 2024
123d36a
chore: sync branch to template
0x4007 Jul 19, 2024
67dc2a6
chore: remove unused file
0x4007 Jul 19, 2024
e6f334a
fix: static to full-stack-app
0x4007 Jul 22, 2024
acae5b2
Merge pull request #265 from 0x4007/chore/sync-card-branch-to-template
0x4007 Jul 22, 2024
8496d63
chore: remove unused
Keyrxng Jul 22, 2024
a929739
chore: tsconfig
Keyrxng Jul 23, 2024
16e7052
Merge pull request #266 from ubq-testing/beta-sync-additions
0x4007 Jul 24, 2024
28a63b5
chore: use blockcscan for multichain balance overview
Keyrxng Jul 26, 2024
c054e2a
chore: fix typo
Keyrxng Jul 26, 2024
51f4c4b
Merge pull request #269 from ubq-testing/funder-balance-beta
0x4007 Jul 26, 2024
d522d96
build: remove non existing kebab case scripts use
EresDev Jul 26, 2024
48f6019
feat: list cards by user country
EresDev Jul 26, 2024
dc5af98
fix: correct type for virtual cards list response
EresDev Jul 29, 2024
0a344d0
fix: offer only range price virtual cards
EresDev Jul 29, 2024
c91b937
fix: remove also available in price section
EresDev Jul 29, 2024
eb72bc2
Revert "fix: offer only range price virtual cards"
EresDev Jul 29, 2024
5d8f4bc
fix: offer cards only in permit amount range
EresDev Jul 29, 2024
937a08a
fix: adjust overlapping UI elements
EresDev Aug 2, 2024
adacb74
fix: remove redundent code
EresDev Aug 2, 2024
aba2293
fix: remove UI elements jump on cards load
EresDev Aug 2, 2024
393f139
fix: log correct variable name
EresDev Aug 2, 2024
80b429a
fix: filter by product category
EresDev Aug 2, 2024
b9fc842
feat: detect user country by ip
EresDev Aug 6, 2024
276956e
chore: fix spells
EresDev Aug 6, 2024
8ad0c36
build: set USE_RELOADLY_SANDBOX to a string
rndquu Aug 7, 2024
bd8dd9a
Merge pull request #2 from rndquu/build/wrangler-config
EresDev Aug 7, 2024
68060db
Merge pull request #270 from EresDevOrg/beta
EresDev Aug 15, 2024
4e757a6
chore: add reloadly cards & countries lists
EresDev Aug 15, 2024
a01ee92
feat: display single suitable virutal card to user
EresDev Aug 21, 2024
c281cbe
fix: pick intl mastercard/visa for allowed countries
EresDev Aug 22, 2024
aa300f1
fix: pick local mastercard/visa as last option
EresDev Aug 22, 2024
632b858
refactor: shorten vars' names
EresDev Aug 22, 2024
061bde2
fix: load ordered card details with order
EresDev Aug 23, 2024
35dc73b
fix: replace card list with single card in UI
EresDev Aug 23, 2024
97c7198
fix: update UI for single virtual card
EresDev Aug 26, 2024
b07f8fd
fix: place redeem info in new UI
EresDev Aug 26, 2024
e10871b
fix: update UI for purchased virtual card
EresDev Aug 27, 2024
6bae6f4
fix: improve ui
EresDev Aug 27, 2024
dd9cf0d
refactor: repalce term claim card with mint card
EresDev Aug 27, 2024
3bc8d5c
fix: apply changes for dark/light theme consistancy
EresDev Aug 27, 2024
11d6dd9
fix: stop minting card if permit is not claimable
EresDev Aug 27, 2024
619667d
fix: make sandbox usable with special function
EresDev Aug 28, 2024
c57c245
fix: check allowed country before loading cards
EresDev Aug 28, 2024
61e7b24
refactor: load cards list in selector function
EresDev Aug 28, 2024
e366bc2
fix: check suitable card on order placement
EresDev Aug 28, 2024
7994fa1
fix: send correct product id to post order
EresDev Aug 28, 2024
2589db9
refactor: reword claim to mint
EresDev Aug 28, 2024
56f62af
chore: fix spellings
EresDev Aug 28, 2024
f36277b
refactor: rename functions & routes
EresDev Aug 28, 2024
71e017a
refactor: move activate info with card html
EresDev Aug 28, 2024
af0b71f
refactor: improve html class names
EresDev Aug 28, 2024
85f7137
refactor: remove redundant activate action
EresDev Aug 28, 2024
4e6929b
refactor: remove redundant html element
EresDev Aug 28, 2024
4a122cf
fix: adjust ui shadow & opacity of light mode
EresDev Aug 28, 2024
715accf
feat: check for permit expiry
EresDev Aug 29, 2024
d6b76ea
docs: fix reason for sandbox function
EresDev Aug 29, 2024
3f09881
fix: improve minting success msg
EresDev Aug 29, 2024
793cf69
refactor: remove xml doctype for svg
EresDev Aug 29, 2024
1cc67af
refactor: lazy load virtual cards from API
EresDev Aug 29, 2024
161dec2
test: fix broken e2e tests
EresDev Aug 29, 2024
8390a86
fix: set card treasury address
EresDev Aug 29, 2024
ac5e590
test: update ip mock data
EresDev Aug 29, 2024
b566de8
fix: consider reward amount in picking best card
EresDev Aug 29, 2024
d1841ab
chore: change treasury for testing on mainnet
EresDev Aug 29, 2024
18f3ae6
Revert "chore: change treasury for testing on mainnet"
EresDev Aug 29, 2024
9a2fb76
feat: add wait mechanism for delayed minting
EresDev Aug 29, 2024
dbd5ffe
fix: apply correct border to card img
EresDev Aug 31, 2024
5b976d9
refactor: use record for country list
EresDev Sep 5, 2024
db710e4
docs: add info to use virtual card feature
EresDev Sep 6, 2024
255e221
docs: fix spellings
EresDev Sep 6, 2024
69dfbeb
fix: correct country name in allowed list
EresDev Sep 11, 2024
ed530bd
refactor: remove redundant space
EresDev Sep 11, 2024
d4083ca
fix: reword the error message
EresDev Sep 11, 2024
ed6accb
fix: reword heading
EresDev Sep 11, 2024
619193a
fix: reword error message
EresDev Sep 11, 2024
60e8a4d
fix: reword purchased card heading
EresDev Sep 11, 2024
2bb4c20
fix: reword minting error message
EresDev Sep 11, 2024
bb5ec42
Merge pull request #277 from EresDevOrg/beta
EresDev Sep 11, 2024
27f332a
feat: mint gift card with ubiquity dollars
whilefoo Sep 22, 2024
5fb3c53
fix: knip
whilefoo Sep 22, 2024
a0ebf5e
feat: handle multiple networks for ubiquity dollar
whilefoo Sep 28, 2024
4382035
fix: spelling
whilefoo Sep 28, 2024
7030020
feat: support optimism network
whilefoo Sep 30, 2024
ee89f7d
fix: throw error
whilefoo Sep 30, 2024
31674ad
Merge pull request #313 from whilefoo/ubiquity-dollar
0x4007 Oct 5, 2024
c8f4209
fix: show rewards page
rndquu Oct 14, 2024
86e54cd
fix: resolve conflicts
rndquu Oct 14, 2024
ca5fb09
build: fix
rndquu Oct 14, 2024
ae4d8d9
ci: fix cspell
rndquu Oct 14, 2024
68f2a44
ci: fix knip
rndquu Oct 14, 2024
affddbb
style: fix
rndquu Oct 14, 2024
7ca3aa9
style: fix fonts
rndquu Oct 14, 2024
a065e22
feat: separate knip report and deployment comments
zugdev Oct 14, 2024
e0cca5d
test: add react as a dependency to trigger a knip report
zugdev Oct 14, 2024
496b017
feat: check for workflow runner's identity
zugdev Oct 14, 2024
44eab93
test: test workflows
zugdev Oct 14, 2024
8fd8aaf
test: add package to test knip
zugdev Oct 15, 2024
9039d17
chore: lint
zugdev Oct 15, 2024
83d43ce
chore: remove testing packages
zugdev Oct 15, 2024
db22f56
feat: centralize button visibility responsibility and delete a lot of…
zugdev Oct 15, 2024
1d46b85
Merge pull request #338 from zugdev/fix-invalidation-button
0x4007 Oct 15, 2024
c8b09a8
fix: resolve conflicts
rndquu Oct 15, 2024
722e7bb
ci: fix cspell
rndquu Oct 15, 2024
84c49d8
Merge pull request #334 from rndquu/refactor/beta-to-dev
0x4007 Oct 15, 2024
b0b3cf5
Merge branch 'development' of https://github.com/ubiquity/pay.ubq.fi …
zugdev Oct 15, 2024
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
7 changes: 7 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"useGitignore": true,
"language": "en",
"words": [
"adblocker",
"binkey",
"binsec",
"blockscan",
Expand All @@ -15,6 +16,8 @@
"devpool",
"ethersproject",
"fract",
"giftcards",
"gnosischain",
"funder",
"Funder",
"gnosisscan",
Expand All @@ -29,9 +32,13 @@
"Numberish",
"outdir",
"outfile",
"pageable",
"ress",
"Reloadly",
"Rpcs",
"scalarmult",
"servedir",
"skus",
"solmate",
"sonarjs",
"SUPABASE",
Expand Down
4 changes: 2 additions & 2 deletions .github/knip.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { KnipConfig } from "knip";

const config: KnipConfig = {
entry: ["build/esbuild-build.ts", "static/scripts/rewards/init.ts"],
project: ["src/**/*.ts", "static/scripts/**/*.ts"],
entry: ["build/esbuild-build.ts", "static/scripts/rewards/init.ts", "static/scripts/ubiquity-dollar/init.ts", "static/scripts/shared/api.ts"],
project: ["src/**/*.ts", "static/scripts/**/*.ts", "shared/**/api-types.ts"],
ignore: ["src/types/config.ts", "**/__mocks__/**", "**/__fixtures__/**", "lib/**/*"],
ignoreExportsUsedInFile: true,
// eslint can also be safely ignored as per the docs: https://knip.dev/guides/handling-issues#eslint--jest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ jobs:
name: full-stack-app
path: |
static
functions
shared
package.json
yarn.lock
9 changes: 6 additions & 3 deletions .github/workflows/cypress-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ jobs:
sleep 1
done || exit 1

- name: Fund test accounts
run: yarn test:fund
- name: Start Cloudflare Wrangler
run: npx wrangler pages dev static --port 8080 --binding USE_RELOADLY_SANDBOX=true RELOADLY_API_CLIENT_ID="$RELOADLY_SANDBOX_API_CLIENT_ID" RELOADLY_API_CLIENT_SECRET="$RELOADLY_SANDBOX_API_CLIENT_SECRET" &
env:
RELOADLY_SANDBOX_API_CLIENT_ID: ${{ secrets.RELOADLY_SANDBOX_API_CLIENT_ID }}
RELOADLY_SANDBOX_API_CLIENT_SECRET: ${{ secrets.RELOADLY_SANDBOX_API_CLIENT_SECRET }}

- name: Cypress run
uses: cypress-io/github-action@v6
with:
build: yarn run build
start: yarn start
start: yarn test:fund

env:
SUPABASE_URL: "https://wfzpewmlyiozupulbuur.supabase.co"
Expand Down
40 changes: 23 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ jobs:
name: Automatic Cloudflare Deploy
runs-on: ubuntu-22.04
steps:
- name: Verify Runner's Identity
id: verify-runner
run: |
echo "Runner name: $RUNNER_NAME"
if [[ "$RUNNER_NAME" != *"GitHub Actions"* ]]; then
echo "This workflow must run on a GitHub Actions runner. (github-actions[bot])"
exit 1
fi
- name: Deploy to Cloudflare
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: ubiquity/cloudflare-deploy-action@main
Expand Down Expand Up @@ -84,25 +92,23 @@ jobs:
issue_number,
});

// Find the comment to update or create a new one if not found
let existingComment = comments.data.find(comment => comment.user.login === 'github-actions[bot]');
let body = '| Preview Deployment |\n| ------------------ |\n';
// Look for an existing "Preview Deployment" comment
let previewComment = comments.data.find(comment =>
comment.body.startsWith("| Preview Deployment |")
);

const body = `| Preview Deployment |\n| ------------------ |\n| [${sha}](${{ env.CLAIMABLE_URL }}) |\n`;

// If the comment exists, update its body
if (existingComment) {
// Check if the SHA already exists in the comment body to avoid duplicates
if (!existingComment.body.includes(sha)) {
body = existingComment.body + `| [${sha}](${{ env.CLAIMABLE_URL }}) |\n`;
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existingComment.id,
body
});
}
if (previewComment) {
// Update the existing "Preview Deployment" comment
await github.rest.issues.updateComment({
owner,
repo,
comment_id: previewComment.id,
body
});
} else {
// Create a new comment if no existing comment is found
body += `| [${sha}](${{ env.CLAIMABLE_URL }}) |\n`;
// Create a new "Preview Deployment" comment if not found
await github.rest.issues.createComment({
owner,
repo,
Expand Down
40 changes: 38 additions & 2 deletions .github/workflows/knip-reporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion != 'success' }}
steps:
- name: Verify Runner's Identity
id: verify-runner
run: |
echo "Runner name: $RUNNER_NAME"
if [[ "$RUNNER_NAME" != *"GitHub Actions"* ]]; then
echo "This workflow must run on a GitHub Actions runner. (github-actions[bot])"
exit 1
fi
- uses: actions/download-artifact@v4
with:
name: knip-results
Expand All @@ -24,11 +32,39 @@ jobs:
path: ./pr-number.txt
trim: true

- name: Report knip results to pull request
- name: Get or create comment ID for Knip Report
id: get-comment
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const issue_number = ${{ steps.pr-number.outputs.content }};

// Fetch all comments on the PR
const comments = await github.rest.issues.listComments({
owner,
repo,
issue_number,
});

// Look for an existing Knip report comment
let knipComment = comments.data.find(comment =>
comment.body.startsWith("| Knip Report |")
);

if (knipComment) {
console.log('Found existing Knip report comment:', knipComment.id);
core.setOutput('comment_id', knipComment.id); // Set the comment ID output
} else {
console.log('No existing Knip report comment found.');
core.setOutput('comment_id', ''); // No existing comment
}

- name: Report Knip results to pull request
uses: gitcoindev/knip-reporter@main
with:
verbose: true
comment_id: ${{ github.workflow }}-reporter
comment_id: ${{ steps.get-comment.outputs.comment_id || github.workflow }}-knip-report
command_script_name: knip-ci
annotations: true
ignore_results: false
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ static/bundles

cypress/screenshots
cypress/videos
.wrangler
coverage
junit.xml
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,39 @@ A vanilla Typescript dApp for claiming Ubiquity Rewards. It also includes tools
SUPABASE_ANON_KEY="...." # used for storing permit tx data

# Variables depending on spender (bounty hunter)
AMOUNT_IN_ETH="1"
AMOUNT_IN_ETH="50"
BENEFICIARY_ADDRESS="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"

# Legacy env vars (only used when invalidating **REAL** permits via /scripts/solidity/getInvalidateNonceParams.ts)
NONCE="0"
NONCE_SIGNER_ADDRESS="0x"
```

3. Update values for wrangler variables to use Reloadly sandbox or production API in the `wrangler.toml` file.

```
[vars]
USE_RELOADLY_SANDBOX = "true"
RELOADLY_API_CLIENT_ID = "xxxxxxxxxxxxxxxxxx"
RELOADLY_API_CLIENT_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

## Local Testing

1. Set `.env` variables.
2. Run `yarn test:anvil` in terminal A and `yarn test:fund` in terminal B.
3. In terminal B, run `yarn start`.
2. Run `yarn`
3. Run `yarn test:anvil` in terminal A and `yarn test:fund` in terminal B.
4. In terminal B, run

```
yarn build
yarn start
```

4. A permit URL for both ERC20 and ERC721 will be generated.
5. Open the generated permit URL from the console.
6. Connect your wallet (import anvil accounts [0] & [1] into your wallet).
7. Depending on your connected account, either the claim or invalidate button will be visible.
7. Depending on your connected account, either the claim or invalidate button will be visible. The virtual card section will also display an available virtual card.
8. To test ERC721 permits, deploy the `nft-rewards` contract from the [repository](https://github.com/ubiquity/nft-rewards).

### Importing Anvil Accounts
Expand Down Expand Up @@ -80,6 +96,19 @@ A vanilla Typescript dApp for claiming Ubiquity Rewards. It also includes tools
- Ensure `.env` is correctly configured and wallet provider network is correct if `Allowance` or `Balance` is `0.00`.
- Always start the Anvil instance before using `yarn start` as permit generation requires an on-chain call to `token.decimals()`.

### Troubleshooting virtual cards

Virtual cards are subject to regulations and are not available for all countries. Moreover, each virtual card is available for specific amounts. If you are unable to see an available virtual card it is either because of your location or the amount of your permit.

If you are not getting an available card, you can perform a few extra steps to get a virtual card for testing purposes. You can set the permit amount `AMOUNT_IN_ETH` to be 50 WXDAI in the `.env` file and mock your location as United States. To set your location to United States, you can follow one of the steps given below:

- Use a USA VPN
- Set your timezone to `Eastern Time (ET) New York` and block the ajax request to `https://ipinfo.io/json` so that your timezone is used to detect your location.

One of these steps should get you a virtual card to try both on Reloadly sandbox and production. Please note that if you are minting a virtual card with a mock location on Reloadly production, you will get a redeem code but you may not able to use the card due to restrictions on the card, and there is no refund or replacement. Use your real location if you want to use the virtual card.

If you are using mainnet with your local environments, you may want to change the `giftCardTreasuryAddress` to a wallet that you own in the file `shared/constants.ts`. It is the wallet where payments for the virtual cards are sent.

## How to generate a permit2 URL using the script

1. Admin sets `env.AMOUNT_IN_ETH` and `env.BENEFICIARY_ADDRESS` depending on a bounty hunter's reward and address
Expand Down
10 changes: 6 additions & 4 deletions build/esbuild-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ const cssFiles: string[] = [
"static/styles/rewards/background.css",
"static/styles/toast.css",
"static/styles/rewards/claim-table.css",
"static/styles/rewards/gift-cards.css",
"static/styles/rewards/ubiquity-dollar.css",
"static/styles/rewards/media-queries.css",
"static/styles/rewards/light-mode.css",
];

// Output bundles file
const outputFilePath = "static/bundles/bundles.css";
const outputFilePath = "static/out/bundles.css";

const typescriptEntries = ["static/scripts/rewards/init.ts"];
const typescriptEntries = ["static/scripts/rewards/init.ts", "static/scripts/ubiquity-dollar/init.ts"];
export const entries = [...typescriptEntries];

export const esBuildContext: esbuild.BuildOptions = {
Expand All @@ -32,8 +34,8 @@ export const esBuildContext: esbuild.BuildOptions = {
".ttf": "dataurl",
".svg": "dataurl",
},
outfile: "static/bundles/bundles.js",
entryNames: "bundles", // Ensure the CSS is named bundles.css
outdir: "static/out",
entryNames: "[dir]", // Ensure the CSS is named bundles.css
define: createEnvDefines(["SUPABASE_URL", "SUPABASE_ANON_KEY"], {
commitHash: execSync(`git rev-parse --short HEAD`).toString().trim(),
}),
Expand Down
3 changes: 3 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default defineConfig({
},
baseUrl: "http://localhost:8080",
experimentalStudio: true,
env: {
permitConfig: { ...process.env },
},
},
viewportHeight: 900,
viewportWidth: 1440,
Expand Down
Loading
Loading