@akita-protocol/algomd-rn 1.0.0-alpha.5 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akita-protocol/algomd-rn",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"types": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@akita-protocol/sdk": ">=1.
|
|
14
|
+
"@akita-protocol/sdk": ">=1.5.0-canary.0",
|
|
15
15
|
"@akita-protocol/txn-graph-rn": ">=0.2.1",
|
|
16
|
-
"@algorandfoundation/algokit-utils": "
|
|
16
|
+
"@algorandfoundation/algokit-utils": "^9.2.2",
|
|
17
17
|
"@gorhom/bottom-sheet": ">=5.0.0",
|
|
18
18
|
"@shopify/flash-list": ">=2.0.0",
|
|
19
19
|
"@tanstack/react-query": ">=5",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@akita-protocol/sdk": "1.
|
|
43
|
-
"@algorandfoundation/algokit-utils": "
|
|
42
|
+
"@akita-protocol/sdk": "1.5.0-canary.0",
|
|
43
|
+
"@algorandfoundation/algokit-utils": "^9.2.2",
|
|
44
44
|
"@gorhom/bottom-sheet": "^5.2.14",
|
|
45
45
|
"@playwright/test": "^1.63.0",
|
|
46
46
|
"@storybook/addon-a11y": "10.6.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/pixelmatch": "^7.1.0",
|
|
53
53
|
"@types/pngjs": "^6.0.5",
|
|
54
54
|
"@types/react": "^19.1.0",
|
|
55
|
-
"algosdk": "^3.
|
|
55
|
+
"algosdk": "^3.7.0",
|
|
56
56
|
"autoprefixer": "^10.5.6",
|
|
57
57
|
"buffer": "^6.0.3",
|
|
58
58
|
"esbuild": "^0.25.12",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"vite": "^6.4.3"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@akita-protocol/algomd-core": "1.0.0-alpha.
|
|
82
|
+
"@akita-protocol/algomd-core": "1.0.0-alpha.7"
|
|
83
83
|
},
|
|
84
84
|
"exports": {
|
|
85
85
|
".": "./src/index.ts",
|
|
@@ -56,8 +56,9 @@ async function fetchASAForGraph(
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
try {
|
|
59
|
-
const info = await algorand.client.algod.
|
|
59
|
+
const info = await algorand.client.algod.getAssetByID(BigInt(assetId)).do();
|
|
60
60
|
const p = info.params;
|
|
61
|
+
if (!p) throw new Error(`Asset ${assetId} has no params`);
|
|
61
62
|
return {
|
|
62
63
|
id: Number(assetId),
|
|
63
64
|
name: p.name ?? `Asset #${assetId}`,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
type DecodedStakingPoolReward,
|
|
39
39
|
} from "../utils/stakingPool";
|
|
40
40
|
import type { AlgorandClient } from "@algorandfoundation/algokit-utils";
|
|
41
|
-
import { getApplicationAddress } from "
|
|
41
|
+
import { getApplicationAddress } from "algosdk";
|
|
42
42
|
import type {
|
|
43
43
|
AlgorandAccount,
|
|
44
44
|
ASA as ASAType,
|
|
@@ -124,8 +124,9 @@ async function fetchASADetails(
|
|
|
124
124
|
// Asset precision is transaction-critical. Let the owning query surface a
|
|
125
125
|
// lookup error instead of fabricating a zero-decimal ASA that could turn a
|
|
126
126
|
// human amount into the wrong number of base units.
|
|
127
|
-
const info = await algorand.client.algod.
|
|
127
|
+
const info = await algorand.client.algod.getAssetByID(BigInt(assetId)).do();
|
|
128
128
|
const params = info.params;
|
|
129
|
+
if (!params) throw new Error(`Asset ${assetId} has no params`);
|
|
129
130
|
return {
|
|
130
131
|
id: Number(assetId),
|
|
131
132
|
name: params.name ?? `Asset #${assetId}`,
|
|
@@ -287,7 +288,7 @@ async function fetchPrizeBoxBundle(
|
|
|
287
288
|
const fallback: PrizeBoxBundle = { appId, address, holdings: [] };
|
|
288
289
|
|
|
289
290
|
try {
|
|
290
|
-
const info = await algorand.client.algod.accountInformation(address);
|
|
291
|
+
const info = await algorand.client.algod.accountInformation(address).do();
|
|
291
292
|
const assetBalances = (info.assets ?? []).filter(
|
|
292
293
|
(holding: { amount: bigint }) => holding.amount > BigInt(0),
|
|
293
294
|
);
|
|
@@ -358,7 +359,7 @@ export function useAccountData(address: string | undefined) {
|
|
|
358
359
|
queryKey: ["algomd", config.network, "account", address],
|
|
359
360
|
queryFn: async (): Promise<AlgorandAccount> => {
|
|
360
361
|
if (!address) throw new Error("No address provided");
|
|
361
|
-
const info = await algorand.client.algod.accountInformation(address);
|
|
362
|
+
const info = await algorand.client.algod.accountInformation(address).do();
|
|
362
363
|
const assets: ASAType[] = (info.assets ?? []).map(
|
|
363
364
|
(a: { assetId: bigint; amount: bigint }) => ({
|
|
364
365
|
id: Number(a.assetId),
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
2
|
import { AlgorandClient } from '@algorandfoundation/algokit-utils'
|
|
3
|
-
import { AlgodClient } from '@algorandfoundation/algokit-utils/algod-client'
|
|
4
3
|
import algosdk from 'algosdk'
|
|
5
|
-
import { makeEmptyTransactionSigner } from '@algorandfoundation/algokit-utils/transact'
|
|
6
4
|
import { useAlgomd } from '../provider/context'
|
|
7
5
|
import { NETWORK_DEFAULTS } from '../provider/networks'
|
|
8
6
|
|
|
@@ -21,17 +19,12 @@ export function useAlgorandClient(): AlgorandClient {
|
|
|
21
19
|
const token = config.algodToken ?? defaults.algodToken ?? ''
|
|
22
20
|
|
|
23
21
|
const client = AlgorandClient.fromClients({
|
|
24
|
-
algod: new
|
|
25
|
-
baseUrl: server,
|
|
26
|
-
port,
|
|
27
|
-
token,
|
|
28
|
-
headers: config.headers,
|
|
29
|
-
}),
|
|
22
|
+
algod: new algosdk.Algodv2(token, server, port, config.headers),
|
|
30
23
|
})
|
|
31
24
|
|
|
32
25
|
// Register an empty signer so explicitly simulated read methods can run
|
|
33
26
|
// without a real signer. This is safe — algomd-rn is a display library.
|
|
34
|
-
client.setDefaultSigner(makeEmptyTransactionSigner())
|
|
27
|
+
client.setDefaultSigner(algosdk.makeEmptyTransactionSigner())
|
|
35
28
|
|
|
36
29
|
return client
|
|
37
30
|
}, [config.network, config.algodServer, config.algodPort, config.algodToken, config.headers])
|
|
@@ -49,6 +42,15 @@ export function useIndexerClient(): algosdk.Indexer | null {
|
|
|
49
42
|
const server = config.indexerServer ?? defaults.indexerServer
|
|
50
43
|
if (!server) return null
|
|
51
44
|
const token = config.indexerToken ?? defaults.indexerToken ?? ''
|
|
52
|
-
return new algosdk.Indexer(token, server,
|
|
45
|
+
return new algosdk.Indexer(token, server, urlPort(server), config.headers)
|
|
53
46
|
}, [config.network, config.indexerServer, config.indexerToken, config.headers])
|
|
54
47
|
}
|
|
48
|
+
|
|
49
|
+
/** The URL's explicit port, or "" for the scheme default, so algosdk keeps the configured port. */
|
|
50
|
+
function urlPort(url: string): string {
|
|
51
|
+
try {
|
|
52
|
+
return new URL(url).port
|
|
53
|
+
} catch {
|
|
54
|
+
return ''
|
|
55
|
+
}
|
|
56
|
+
}
|