Skip to content

Commit 6aa1f77

Browse files
committed
Use Alchemy API for testnet Polygon access as well
1 parent 66abad3 commit 6aa1f77

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ node_modules
55
# local env files
66
.env.local
77
.env.*.local
8+
public/k_*
89

910
# Log files
1011
npm-debug.log*

src/config/config.local.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export default {
1414
usdc: {
1515
enabled: true,
1616
networkId: 80001,
17-
rpcEndpoint: 'https://matic-mumbai.chainstacklabs.com',
18-
rpcMaxBlockRange: 10_000,
17+
rpcEndpoint: 'wss://polygon-mumbai.g.alchemy.com/v2/#ALCHEMY_API_KEY#',
18+
rpcMaxBlockRange: 1_296_000, // 30 days - Range not limited, only limited by number of logs returned
1919
// eslint-disable-next-line max-len
2020
// rpcEndpoint: 'wss://shy-sparkling-wind.matic-testnet.discover.quiknode.pro/4461ca78cea96dd6a168a58d8fc30a021cabf01d/',
2121
usdcContract: '0x0FA8781a83E46826621b3BC094Ea2A0212e71B23',

src/config/config.testnet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export default {
1414
usdc: {
1515
enabled: true,
1616
networkId: 80001,
17-
rpcEndpoint: 'https://matic-mumbai.chainstacklabs.com',
18-
rpcMaxBlockRange: 10_000,
17+
rpcEndpoint: 'wss://polygon-mumbai.g.alchemy.com/v2/#ALCHEMY_API_KEY#',
18+
rpcMaxBlockRange: 1_296_000, // 30 days - Range not limited, only limited by number of logs returned
1919
usdcContract: '0x0FA8781a83E46826621b3BC094Ea2A0212e71B23',
2020
transferContract: '0x2805f3187dcDfa424EFA8c55Db6012Cf08Fa6eEc', // v3
2121
htlcContract: '0x2EB7cd7791b947A25d629219ead941fCd8f364BF', // v3

src/i18n/en.po

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ msgstr ""
851851

852852
#: src/components/modals/BtcSendModal.vue:441
853853
#: src/components/modals/SendModal.vue:600
854-
#: src/components/modals/UsdcSendModal.vue:560
854+
#: src/components/modals/UsdcSendModal.vue:561
855855
msgid "Edit transaction"
856856
msgstr ""
857857

@@ -950,7 +950,7 @@ msgstr ""
950950
msgid "Failed"
951951
msgstr ""
952952

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

17401740
#: src/components/modals/BtcSendModal.vue:440
17411741
#: src/components/modals/SendModal.vue:599
1742-
#: src/components/modals/UsdcSendModal.vue:559
1742+
#: src/components/modals/UsdcSendModal.vue:560
17431743
msgid "Retry"
17441744
msgstr ""
17451745

@@ -1876,7 +1876,7 @@ msgstr ""
18761876

18771877
#: src/components/modals/BtcSendModal.vue:437
18781878
#: src/components/modals/SendModal.vue:596
1879-
#: src/components/modals/UsdcSendModal.vue:556
1879+
#: src/components/modals/UsdcSendModal.vue:557
18801880
msgid "Sending Transaction"
18811881
msgstr ""
18821882

@@ -1902,11 +1902,11 @@ msgstr ""
19021902
msgid "Sent {nim} NIM to {name}"
19031903
msgstr ""
19041904

1905-
#: src/components/modals/UsdcSendModal.vue:595
1905+
#: src/components/modals/UsdcSendModal.vue:596
19061906
msgid "Sent {usdc} USDC"
19071907
msgstr ""
19081908

1909-
#: src/components/modals/UsdcSendModal.vue:591
1909+
#: src/components/modals/UsdcSendModal.vue:592
19101910
msgid "Sent {usdc} USDC to {name}"
19111911
msgstr ""
19121912

@@ -2011,7 +2011,7 @@ msgstr ""
20112011

20122012
#: src/components/modals/BtcSendModal.vue:509
20132013
#: src/components/modals/SendModal.vue:647
2014-
#: src/components/modals/UsdcSendModal.vue:607
2014+
#: src/components/modals/UsdcSendModal.vue:608
20152015
msgid "Something went wrong"
20162016
msgstr ""
20172017

src/lib/KeyReplacer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ export async function replaceKey(input: string): Promise<string> {
88

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

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

1618
// Create the resulting string without the delimiters
1719
return sections.join('');

0 commit comments

Comments
 (0)