Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 60dca0b

Browse files
authored
Merge branch 'main' into patch-1
2 parents 7e9ff9d + 1cd13e4 commit 60dca0b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4644
-836
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import dynamic from "next/dynamic";
2+
3+
export const DynamicPreloadSearch = dynamic(() => import("./PreloadSearch"), {
4+
ssr: false,
5+
});
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"use client";
2+
3+
import { useEffect } from "react";
4+
5+
export interface PreloadSearchProps {}
6+
7+
/**
8+
* Hack to Preloads Search by making a search request, then clearing it.
9+
*
10+
* NOTE: This must be client-side only as it includes a useEffect hook.
11+
*
12+
* @see https://github.com/shuding/nextra/blob/v3/packages/nextra-theme-docs/src/components/flexsearch.tsx
13+
* @see https://github.com/shuding/nextra/blob/v3/packages/nextra-theme-docs/src/components/search.tsx
14+
*/
15+
export function PreloadSearch(): JSX.Element | null {
16+
useEffect(() => {
17+
// Try desktop nav container first
18+
let container = document.querySelector(".nextra-nav-container");
19+
20+
// Fallback to mobile sidebar container
21+
if (!container) {
22+
container = document.querySelector(".nextra-sidebar-container");
23+
}
24+
25+
if (!container) return;
26+
27+
const input = container.querySelector(
28+
'input[type="search"]',
29+
) as HTMLInputElement;
30+
if (!input) return;
31+
32+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
33+
window.HTMLInputElement.prototype,
34+
"value",
35+
)?.set;
36+
37+
nativeInputValueSetter?.call(input, "warmup");
38+
input.dispatchEvent(new Event("input", { bubbles: true }));
39+
40+
setTimeout(() => {
41+
nativeInputValueSetter?.call(input, "");
42+
input.dispatchEvent(new Event("input", { bubbles: true }));
43+
}, 500);
44+
}, []);
45+
46+
return null;
47+
}
48+
49+
export default PreloadSearch;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./PreloadSearch";
2+
export * from "./DynamicPreloadSearch";

apps/nextra/next.config.mjs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,13 +1656,6 @@ export default withBundleAnalyzer(
16561656
"https://learn.aptoslabs.com/en/dapp-templates/boilerplate-template",
16571657
permanent: true,
16581658
},
1659-
{
1660-
source:
1661-
"/en/build/create-aptos-dapp/templates/clicker-game-tg-mini-app",
1662-
destination:
1663-
"https://learn.aptoslabs.com/en/dapp-templates/telegram-mini-app-template",
1664-
permanent: true,
1665-
},
16661659
{
16671660
source: "/en/build/create-aptos-dapp/templates/nft-minting-dapp",
16681661
destination:

apps/nextra/pages/_app.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { GoogleAnalytics } from "@next/third-parties/google";
22
import { docsConfig } from "@docs-config";
33
import "../styles.css";
4+
import { DynamicPreloadSearch } from "@components/preload-search";
45

56
export const config = {
67
runtime: "experimental-edge",
@@ -15,6 +16,7 @@ export default function App({ Component, pageProps }) {
1516
return (
1617
<>
1718
<GoogleAnalytics gaId={docsConfig.googleAnalyticsId} />
19+
<DynamicPreloadSearch />
1820
<Component {...pageProps} />
1921
</>
2022
);

apps/nextra/pages/_document.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ class MyDocument extends Document {
2121
`,
2222
}}
2323
/>
24+
<link
25+
rel="preload"
26+
href="/_next/static/chunks/nextra-data-en.json"
27+
as="fetch"
28+
type="application/json"
29+
crossOrigin="anonymous"
30+
/>
2431
</Head>
2532
<body>
2633
<SkipNavLink styled />

apps/nextra/pages/en/build/cli/install-cli/install-cli-windows.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ When installing Aptos via a package manager, please update it through the same p
3737
```powershell filename="Terminal"
3838
choco install aptos
3939
```
40+
### If you have [winget](https://winget.run/) installed, you can run the following command to install the Aptos CLI:
41+
42+
```powershell filename="Terminal"
43+
winget install aptos
44+
```
4045

4146
# Install via Pre-Compiled Binaries (Backup Method)
4247

apps/nextra/pages/en/build/create-aptos-dapp.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ The goals of the templates are to:
7979
All current templates are available on [Aptos Learn](https://learn.aptoslabs.com/en/dapp-templates). Read more about specific templates below:
8080

8181
- [Boilerplate Template](https://learn.aptoslabs.com/en/dapp-templates/boilerplate-template)
82-
- [Telegram Mini app Template](https://learn.aptoslabs.com/en/dapp-templates/telegram-mini-app-template)
8382
- [NFT minting dapp Template](https://learn.aptoslabs.com/en/dapp-templates/nft-minting-template)
8483
- [Token minting dapp Template](https://learn.aptoslabs.com/en/dapp-templates/token-minting-template)
8584
- [Token staking dapp Template](https://learn.aptoslabs.com/en/dapp-templates/token-staking-template)

apps/nextra/pages/en/build/guides/exchanges.mdx

Lines changed: 83 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ const [balanceStr] = await aptos.view<[string]>({
211211
const balance = parseInt(balanceStr, 10);
212212
```
213213

214+
Besides SDK, you can also directly use aptos node's [balance API endpoint](../../build/apis/fullnode-rest-api-reference#tag/accounts/GET/accounts/{address}/balance/{asset_type}) to get the balance of a migrated coin or fungible asset.
215+
214216
## Tracking Balance Changes
215217

216218
Balance changes can be queried in one of two ways:
@@ -331,48 +333,80 @@ In this case, we only care about coin store changes.
331333
</details>
332334

333335
3. Events are the events that were emitted by the transaction. In this case, we
334-
only care about the `0x1::coin::deposit` and `0x1::coin::withdraw` events.
336+
only care about the `0x1::coin::Withdraw` and `0x1::coin::Deposit` events.
335337

336-
The Coin deposit event is emitted when coins are deposited into an account. The
337-
account's balance will increase by that amount in the field `data.amoount`. To
338-
determine the matching asset, you must match the `guid` in the `deposit_events`
339-
to the `guid` in the `changes` section for a `CoinStore`.
338+
The Coin withdraw event is emitted when coins are withdrawn from an account. The
339+
account's balance will decrease by that amount in the field `data.amount`. To
340+
determine the matching asset, you must match the `guid` in the `withdraw_events`
341+
to the `guid` in the `changes` section for a `CoinStore`. But if the `CoinStore`
342+
is not found in the `changes`, it means it got deleted, and a `CoinStoreDeleteEvent`
343+
must be present instead. Then you can match the `guid` with
344+
`deleted_withdraw_event_handle_creation_number` and `event_handle_creation_address`.
340345

341346
<details>
342-
<summary>Coin Deposit Event</summary>
347+
<summary>Coin Withdraw Event</summary>
343348
```json
344349
{
345-
"events": [{
346-
"guid": {
347-
"creation_number": "2",
348-
"account_address": "0x5d6233bb8d7f8bd714af196339e9fb3104c9d66f38867b2a0585c4f7b9d04d28"
350+
"events": [
351+
{
352+
"guid": {
353+
"creation_number": "3",
354+
"account_address": "0xf8e25f6c8ce40a15107fb4b4d288ca03dd434d057392f2ccb5fde505a300a0bf"
355+
},
356+
"sequence_number": "0",
357+
"type": "0x1::coin::WithdrawEvent",
358+
"data": {
359+
"amount": "100000"
360+
}
349361
},
350-
"sequence_number": "0",
351-
"type": "0x1::coin::DepositEvent",
352-
"data": {
353-
"amount": "10"
362+
]
363+
}
364+
```
365+
</details>
366+
367+
<details>
368+
<summary>Coin Store Deletion Event</summary>
369+
```json
370+
{
371+
"events": [
372+
{
373+
"guid": {
374+
"creation_number": "0",
375+
"account_address": "0x0"
376+
},
377+
"sequence_number": "0",
378+
"type": "0x1::coin::CoinStoreDeletion",
379+
"data": {
380+
"coin_type": "0x1::aptos_coin::AptosCoin",
381+
"deleted_deposit_event_handle_creation_number": "2",
382+
"deleted_withdraw_event_handle_creation_number": "3",
383+
"event_handle_creation_address": "0xf8e25f6c8ce40a15107fb4b4d288ca03dd434d057392f2ccb5fde505a300a0bf"
384+
}
354385
}
355-
}]
386+
]
356387
}
357388
```
358389
</details>
359390

360-
The Coin withdraw event is emitted when coins are withdrawn from an account. The
361-
account's balance will decrease by that amount in the field `data.amount`. To
391+
The Coin deposit event is emitted when coins are deposited into an account. The
392+
account's balance will increase by that amount in the field `data.amoount`. To
362393
determine the matching asset, you must match the `guid` in the `deposit_events`
363-
to the `guid` in the `changes` section for a `CoinStore`.
394+
to the `guid` in the `changes` section for a `CoinStore`. Similarly, if the `CoinStore`
395+
is not found in the `changes`, it means it got deleted, and a `CoinStoreDeleteEvent`
396+
must be present instead. Then you can match the `guid` with
397+
`deleted_deposit_event_handle_creation_number` and `event_handle_creation_address`.
364398

365399
<details>
366-
<summary>Coin Withdraw Event</summary>
400+
<summary>Coin Deposit Event</summary>
367401
```json
368402
{
369403
"events": [{
370404
"guid": {
371-
"creation_number": "3",
372-
"account_address": "0x559d4f690c683fca7c539237aa8dc4c6ec09886b7016bf66f2cdeffef55468f0"
405+
"creation_number": "2",
406+
"account_address": "0x5d6233bb8d7f8bd714af196339e9fb3104c9d66f38867b2a0585c4f7b9d04d28"
373407
},
374-
"sequence_number": "52484",
375-
"type": "0x1::coin::WithdrawEvent",
408+
"sequence_number": "0",
409+
"type": "0x1::coin::DepositEvent",
376410
"data": {
377411
"amount": "10"
378412
}
@@ -381,6 +415,7 @@ to the `guid` in the `changes` section for a `CoinStore`.
381415
```
382416
</details>
383417

418+
384419
4. Gas usage only is tracked for APT. There is no direct event for tracking gas,
385420
but it can be calculated from the transaction. Using the `gas_used` field, and
386421
the `gas_unit_price` field, you can calculate the total gas used. In this case,
@@ -710,7 +745,10 @@ is the address of the `metadata` for the fungible asset.
710745
Additionally, to figure out the actual owner of the assets, you will need to look
711746
at the owner of the store. In this case, you will need the `0x1::object::ObjectCore`, where
712747
the `address` field matches the `store` field from the events. The `owner` field
713-
will show the asset owner's address.
748+
will show the asset owner's address. similar to the coin events, if the `ObjectCore`
749+
is not found in the `changes`, it means it got deleted, and a `FungibleStoreDeletion`
750+
event must be present instead. Then you can match the `store` fields between the
751+
`Withdraw`/`Deposit` events and the `FungibleStoreDeletion` event.
714752

715753
<details>
716754
<summary>Fungible Asset Changes</summary>
@@ -759,6 +797,25 @@ will show the asset owner's address.
759797
```
760798
</details>
761799

800+
<details>
801+
<summary>FungibleStore Deletion Event</summary>
802+
```json
803+
{
804+
"guid": {
805+
"creation_number": "0",
806+
"account_address": "0x0"
807+
},
808+
"sequence_number": "0",
809+
"type": "0x1::fungible_asset::FungibleStoreDeletion",
810+
"data": {
811+
"metadata": "0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12",
812+
"owner": "0xcf3906e2c9bc7e489c3b09d5ed5d90d8d403a68a50fe52932116b26e5878af26",
813+
"store": "0xa6ab8518e5f28a5f27247a895aa8b3de4a917209c6841b16187e8d64a67de242"
814+
}
815+
}
816+
```
817+
</details>
818+
762819

763820
### Coins migrated to Fungible Asset Balance Changes
764821

@@ -1114,6 +1171,7 @@ Here is an example of a migrated coin with APT: https://api.mainnet.aptoslabs.co
11141171
```
11151172
</details>
11161173

1174+
11171175
## Transferring Assets
11181176

11191177
### Coin (or migrated coin) Transfers
@@ -1160,7 +1218,7 @@ In order to check that everything is working correctly, we've provided these che
11601218
To test balance checks, you can check the balance for the account `0x5` for the asset `0x1::aptos_coin::AptosCoin`.
11611219
The balance should show `0.002 APT`, where 0.001 APT is a coin, and 0.001 APT is a migrated coin (fungible asset).
11621220

1163-
If your balance is not correct, see [Coin and Migrated Coin Balances](#coin-and-migrated-coin-balances) for more information.
1221+
If your balance is not correct, see [Coin and Migrated Coin Balances](#coin-and-migrated-coins-balances) for more information.
11641222

11651223
### Balance Change / Transfer Checks
11661224

0 commit comments

Comments
 (0)