Skip to content

Commit 888d8a0

Browse files
committed
fix: started quickstart without friendbot
1 parent 6a4d57f commit 888d8a0

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ jobs:
4242
else
4343
echo "stellar-scaffold already installed. Clear cache to force reinstall."
4444
fi
45+
- name: Start Stellar local network
46+
uses: stellar/quickstart@main
47+
with:
48+
enable: "core,rpc"
49+
- name: Add master account as default identity
50+
run: |
51+
mkdir -p .config/stellar/identity
52+
echo 'secret_key = "SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L"' > .config/stellar/identity/me.toml
4553
- run: npm ci
4654
- run: npm run lint
4755
- run: npx prettier . --check

src/hooks/useSubscription.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,26 @@ export function useSubscription(
3636
pollInterval = 5000,
3737
) {
3838
const id = `${contractId}:${topic}`
39-
paging[id] = paging[id] || {}
39+
if (!paging[id]) paging[id] = {}
40+
const page = paging[id]
4041

4142
React.useEffect(() => {
4243
let timeoutId: NodeJS.Timeout | null = null
4344
let stop = false
4445

4546
async function pollEvents(): Promise<void> {
4647
try {
47-
if (!paging[id].lastLedgerStart) {
48+
if (!page.lastLedgerStart) {
4849
const latestLedgerState = await server.getLatestLedger()
49-
paging[id].lastLedgerStart = latestLedgerState.sequence
50+
page.lastLedgerStart = latestLedgerState.sequence
5051
}
5152

52-
// lastLedgerStart is now guaranteed to be a number
53-
const lastLedger = paging[id].lastLedgerStart
53+
const lastLedger = page.lastLedgerStart
5454

5555
const response = await server.getEvents(
56-
paging[id].pagingToken
56+
page.pagingToken
5757
? {
58-
cursor: paging[id].pagingToken,
58+
cursor: page.pagingToken,
5959
filters: [
6060
{
6161
contractIds: [contractId],
@@ -79,9 +79,9 @@ export function useSubscription(
7979
},
8080
)
8181

82-
paging[id].pagingToken = undefined
82+
page.pagingToken = undefined
8383
if (response.latestLedger) {
84-
paging[id].lastLedgerStart = response.latestLedger
84+
page.lastLedgerStart = response.latestLedger
8585
}
8686
if (response.events && response.events.length > 0) {
8787
response.events.forEach((event) => {
@@ -94,9 +94,8 @@ export function useSubscription(
9494
)
9595
}
9696
})
97-
// Store the cursor from the response for pagination
9897
if (response.cursor) {
99-
paging[id].pagingToken = response.cursor
98+
page.pagingToken = response.cursor
10099
}
101100
}
102101
} catch (error) {

tsconfig.app.tsbuildinfo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/connectaccount.tsx","./src/components/fundaccountbutton.tsx","./src/components/guessthenumber.tsx","./src/components/networkpill.tsx","./src/components/walletbutton.tsx","./src/contracts/fungible_allowlist_example.ts","./src/contracts/guess_the_number.ts","./src/contracts/nft_enumerable_example.ts","./src/contracts/util.ts","./src/hooks/usenotification.ts","./src/hooks/usesubscription.ts","./src/hooks/usewallet.ts","./src/pages/debug.tsx","./src/pages/home.tsx","./src/providers/notificationprovider.tsx","./src/providers/walletprovider.tsx","./src/util/contract.ts","./src/util/friendbot.ts","./src/util/storage.ts","./src/util/wallet.ts","./reset.d.ts"],"version":"5.9.3"}

0 commit comments

Comments
 (0)