starkzap-starter 0.1.2 → 0.1.3
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/.claude/settings.local.json +9 -0
- package/next.config.mjs +10 -0
- package/package.json +1 -1
- package/src/hooks/useGaslessTransfer.ts +3 -2
- package/src/hooks/useTokenBalance.ts +4 -5
- package/src/lib/empty-module.ts +1 -0
- package/src/lib/stubs/empty.ts +2 -0
- package/src/lib/stubs/tongo-sdk.ts +2 -0
- package/tsconfig.json +26 -7
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(npm run:*)",
|
|
5
|
+
"Bash(grep -rn \"transfer\" /Users/mac/Downloads/starkzap-starter/node_modules/starkzap/dist/src/*.d.ts)",
|
|
6
|
+
"Bash(find /Users/mac/Downloads/starkzap-starter/node_modules/starkzap/dist -name \"address.d.ts\" -exec cat {} \\\\;)"
|
|
7
|
+
]
|
|
8
|
+
}
|
|
9
|
+
}
|
package/next.config.mjs
CHANGED
|
@@ -3,6 +3,16 @@ const nextConfig = {
|
|
|
3
3
|
reactStrictMode: true,
|
|
4
4
|
// Starkzap uses ESM — transpile it so Next.js can bundle it correctly
|
|
5
5
|
transpilePackages: ["starkzap"],
|
|
6
|
+
turbopack: {
|
|
7
|
+
// Starkzap optional peer deps (Solana, Tongo, Hyperlane) — not used in this starter
|
|
8
|
+
resolveAlias: {
|
|
9
|
+
"@fatsolutions/tongo-sdk": "./src/lib/stubs/tongo-sdk.ts",
|
|
10
|
+
"@solana/web3.js": "./src/lib/stubs/empty.ts",
|
|
11
|
+
"@hyperlane-xyz/sdk": "./src/lib/stubs/empty.ts",
|
|
12
|
+
"@hyperlane-xyz/registry": "./src/lib/stubs/empty.ts",
|
|
13
|
+
"@hyperlane-xyz/utils": "./src/lib/stubs/empty.ts",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
6
16
|
};
|
|
7
17
|
|
|
8
18
|
export default nextConfig;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { useState, useCallback } from "react";
|
|
14
|
-
import { getPresets, Amount } from "starkzap";
|
|
14
|
+
import { getPresets, Amount, fromAddress } from "starkzap";
|
|
15
15
|
import type { WalletState } from "./useWallet";
|
|
16
16
|
|
|
17
17
|
export type TransferParams = {
|
|
@@ -59,7 +59,8 @@ export function useGaslessTransfer(
|
|
|
59
59
|
// feeMode: "sponsored" → AVNU paymaster covers gas (gasless for the user)
|
|
60
60
|
// feeMode: "default" → user pays gas normally
|
|
61
61
|
const tx = await wallet.transfer(
|
|
62
|
-
|
|
62
|
+
token,
|
|
63
|
+
[{ to: fromAddress(to), amount: parsedAmount }],
|
|
63
64
|
{ feeMode: "sponsored" }
|
|
64
65
|
);
|
|
65
66
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { useState, useEffect, useCallback } from "react";
|
|
13
|
-
import { getPresets
|
|
13
|
+
import { getPresets } from "starkzap";
|
|
14
14
|
import type { WalletState } from "./useWallet";
|
|
15
15
|
import { network } from "@/lib/starkzap";
|
|
16
16
|
|
|
@@ -46,11 +46,10 @@ export function useTokenBalance(
|
|
|
46
46
|
|
|
47
47
|
if (!token) throw new Error(`Token ${symbol} not found for this network`);
|
|
48
48
|
|
|
49
|
-
const
|
|
50
|
-
const amount = Amount.fromBase(balanceRaw, token);
|
|
49
|
+
const amount = await wallet.balanceOf(token);
|
|
51
50
|
|
|
52
|
-
setRaw(
|
|
53
|
-
setFormatted(amount.
|
|
51
|
+
setRaw(amount.toBase());
|
|
52
|
+
setFormatted(amount.toFormatted(true));
|
|
54
53
|
} catch (err) {
|
|
55
54
|
setError(err instanceof Error ? err.message : "Failed to fetch balance");
|
|
56
55
|
} finally {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/tsconfig.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"lib": [
|
|
3
|
+
"lib": [
|
|
4
|
+
"dom",
|
|
5
|
+
"dom.iterable",
|
|
6
|
+
"esnext"
|
|
7
|
+
],
|
|
4
8
|
"allowJs": true,
|
|
5
9
|
"skipLibCheck": true,
|
|
6
10
|
"strict": true,
|
|
@@ -10,13 +14,28 @@
|
|
|
10
14
|
"moduleResolution": "bundler",
|
|
11
15
|
"resolveJsonModule": true,
|
|
12
16
|
"isolatedModules": true,
|
|
13
|
-
"jsx": "
|
|
17
|
+
"jsx": "react-jsx",
|
|
14
18
|
"incremental": true,
|
|
15
|
-
"plugins": [
|
|
19
|
+
"plugins": [
|
|
20
|
+
{
|
|
21
|
+
"name": "next"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
16
24
|
"paths": {
|
|
17
|
-
"@/*": [
|
|
18
|
-
|
|
25
|
+
"@/*": [
|
|
26
|
+
"./src/*"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"target": "ES2020"
|
|
19
30
|
},
|
|
20
|
-
"include": [
|
|
21
|
-
|
|
31
|
+
"include": [
|
|
32
|
+
"next-env.d.ts",
|
|
33
|
+
"**/*.ts",
|
|
34
|
+
"**/*.tsx",
|
|
35
|
+
".next/types/**/*.ts",
|
|
36
|
+
".next/dev/types/**/*.ts"
|
|
37
|
+
],
|
|
38
|
+
"exclude": [
|
|
39
|
+
"node_modules"
|
|
40
|
+
]
|
|
22
41
|
}
|