Skip to content

Commit

Permalink
Use Alchemy API for testnet Polygon access as well
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Jul 17, 2023
1 parent 66abad3 commit 6aa1f77
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
# local env files
.env.local
.env.*.local
public/k_*

# Log files
npm-debug.log*
Expand Down
4 changes: 2 additions & 2 deletions src/config/config.local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default {
usdc: {
enabled: true,
networkId: 80001,
rpcEndpoint: 'https://matic-mumbai.chainstacklabs.com',
rpcMaxBlockRange: 10_000,
rpcEndpoint: 'wss://polygon-mumbai.g.alchemy.com/v2/#ALCHEMY_API_KEY#',
rpcMaxBlockRange: 1_296_000, // 30 days - Range not limited, only limited by number of logs returned
// eslint-disable-next-line max-len
// rpcEndpoint: 'wss://shy-sparkling-wind.matic-testnet.discover.quiknode.pro/4461ca78cea96dd6a168a58d8fc30a021cabf01d/',
usdcContract: '0x0FA8781a83E46826621b3BC094Ea2A0212e71B23',
Expand Down
4 changes: 2 additions & 2 deletions src/config/config.testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default {
usdc: {
enabled: true,
networkId: 80001,
rpcEndpoint: 'https://matic-mumbai.chainstacklabs.com',
rpcMaxBlockRange: 10_000,
rpcEndpoint: 'wss://polygon-mumbai.g.alchemy.com/v2/#ALCHEMY_API_KEY#',
rpcMaxBlockRange: 1_296_000, // 30 days - Range not limited, only limited by number of logs returned
usdcContract: '0x0FA8781a83E46826621b3BC094Ea2A0212e71B23',
transferContract: '0x2805f3187dcDfa424EFA8c55Db6012Cf08Fa6eEc', // v3
htlcContract: '0x2EB7cd7791b947A25d629219ead941fCd8f364BF', // v3
Expand Down
14 changes: 7 additions & 7 deletions src/i18n/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ msgstr ""

#: src/components/modals/BtcSendModal.vue:441
#: src/components/modals/SendModal.vue:600
#: src/components/modals/UsdcSendModal.vue:560
#: src/components/modals/UsdcSendModal.vue:561
msgid "Edit transaction"
msgstr ""

Expand Down Expand Up @@ -950,7 +950,7 @@ msgstr ""
msgid "Failed"
msgstr ""

#: src/components/modals/UsdcSendModal.vue:658
#: src/components/modals/UsdcSendModal.vue:659
#: src/components/swap/SwapModal.vue:936
msgid "Failed to fetch USDC fees. Retrying... (Error: {message})"
msgstr ""
Expand Down Expand Up @@ -1739,7 +1739,7 @@ msgstr ""

#: src/components/modals/BtcSendModal.vue:440
#: src/components/modals/SendModal.vue:599
#: src/components/modals/UsdcSendModal.vue:559
#: src/components/modals/UsdcSendModal.vue:560
msgid "Retry"
msgstr ""

Expand Down Expand Up @@ -1876,7 +1876,7 @@ msgstr ""

#: src/components/modals/BtcSendModal.vue:437
#: src/components/modals/SendModal.vue:596
#: src/components/modals/UsdcSendModal.vue:556
#: src/components/modals/UsdcSendModal.vue:557
msgid "Sending Transaction"
msgstr ""

Expand All @@ -1902,11 +1902,11 @@ msgstr ""
msgid "Sent {nim} NIM to {name}"
msgstr ""

#: src/components/modals/UsdcSendModal.vue:595
#: src/components/modals/UsdcSendModal.vue:596
msgid "Sent {usdc} USDC"
msgstr ""

#: src/components/modals/UsdcSendModal.vue:591
#: src/components/modals/UsdcSendModal.vue:592
msgid "Sent {usdc} USDC to {name}"
msgstr ""

Expand Down Expand Up @@ -2011,7 +2011,7 @@ msgstr ""

#: src/components/modals/BtcSendModal.vue:509
#: src/components/modals/SendModal.vue:647
#: src/components/modals/UsdcSendModal.vue:607
#: src/components/modals/UsdcSendModal.vue:608
msgid "Something went wrong"
msgstr ""

Expand Down
6 changes: 4 additions & 2 deletions src/lib/KeyReplacer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ export async function replaceKey(input: string): Promise<string> {

const keyName = sections[1];
const fileName = `k_${btoa(keyName)}`;
const encodedKey = await fetch(`/${fileName}`).then((res) => res.text());
const encodedKey = await fetch(`/${fileName}`)
.then((res) => res.text())
.then((text) => text.replace(/\s/g, '')); // Remove any whitespace & newlines

// Replace the key name with the key itself
sections[1] = atob(encodedKey.replace(/\s/g, ''));
sections[1] = atob(encodedKey);

// Create the resulting string without the delimiters
return sections.join('');
Expand Down

0 comments on commit 6aa1f77

Please sign in to comment.