create-solana-mobile-app 1.1.4 → 1.2.1
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/README.md +2 -10
- package/index.js +3 -21
- package/package.json +15 -10
- package/template/solana-kit.d.ts +69 -0
- package/template/package-lock.json +0 -12310
package/README.md
CHANGED
|
@@ -23,25 +23,17 @@ You can choose one of two variants:
|
|
|
23
23
|
### Create a New App
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npx create-solana-mobile-app
|
|
26
|
+
npx create-solana-mobile-app <app-name> --kit-only
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
or
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
npx create-solana-mobile-app
|
|
32
|
+
npx create-solana-mobile-app <app-name> --wallet-ui
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
If no variant flag is provided, `--kit-only` is used by default.
|
|
36
36
|
|
|
37
|
-
Do not run this for scaffolding:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm i create-solana-mobile-app <app-name>
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
That command installs npm packages into the current folder. It does not create a new app.
|
|
44
|
-
|
|
45
37
|
### Run the App
|
|
46
38
|
|
|
47
39
|
```bash
|
package/index.js
CHANGED
|
@@ -8,25 +8,11 @@ const appName = args[0];
|
|
|
8
8
|
const flags = {
|
|
9
9
|
kitOnly: args.includes("--kit-only"),
|
|
10
10
|
walletUI: args.includes("--wallet-ui"),
|
|
11
|
-
help: args.includes("--help") || args.includes("-h"),
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
const TEMPLATE_DIR = "template";
|
|
15
14
|
const DEFAULT_RPC_URL = "https://api.devnet.solana.com";
|
|
16
15
|
|
|
17
|
-
function printUsage() {
|
|
18
|
-
console.log(`Usage:
|
|
19
|
-
create-solana-mobile-app <app-name> [--kit-only|--wallet-ui]
|
|
20
|
-
|
|
21
|
-
Examples:
|
|
22
|
-
npx create-solana-mobile-app@latest my-app --kit-only
|
|
23
|
-
npx create-solana-mobile-app@latest my-app --wallet-ui
|
|
24
|
-
|
|
25
|
-
Important:
|
|
26
|
-
Do NOT run: npm i create-solana-mobile-app <app-name>
|
|
27
|
-
That command installs npm packages and does not scaffold an app.`);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
16
|
async function loadDeps() {
|
|
31
17
|
const { execa } = await import("execa");
|
|
32
18
|
const { default: chalk } = await import("chalk");
|
|
@@ -92,14 +78,10 @@ async function injectBufferPolyfill(appPath) {
|
|
|
92
78
|
async function createApp() {
|
|
93
79
|
const { execa, chalk } = await loadDeps();
|
|
94
80
|
|
|
95
|
-
if (flags.help) {
|
|
96
|
-
printUsage();
|
|
97
|
-
process.exit(0);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
81
|
if (!appName) {
|
|
101
|
-
console.log(
|
|
102
|
-
|
|
82
|
+
console.log(
|
|
83
|
+
"Please provide app name. Usage: create-solana-mobile-app <app-name> [--kit-only|--wallet-ui]",
|
|
84
|
+
);
|
|
103
85
|
process.exit(1);
|
|
104
86
|
}
|
|
105
87
|
|
package/package.json
CHANGED
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-solana-mobile-app",
|
|
3
|
-
"version": "1.1
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "Scaffold Expo + Solana Mobile starter apps with Mobile Wallet Adapter support",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"files": [
|
|
7
|
-
"index.js",
|
|
8
|
-
"README.md",
|
|
9
|
-
"template"
|
|
10
|
-
],
|
|
11
6
|
"bin": {
|
|
12
|
-
"create-solana-mobile-app": "index.js"
|
|
7
|
+
"create-solana-mobile-app": "./index.js"
|
|
13
8
|
},
|
|
14
9
|
"scripts": {
|
|
15
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
16
11
|
},
|
|
17
|
-
"
|
|
12
|
+
"files": [
|
|
13
|
+
"index.js",
|
|
14
|
+
"template/"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"solana",
|
|
18
|
+
"solana-mobile",
|
|
19
|
+
"expo",
|
|
20
|
+
"react-native",
|
|
21
|
+
"mobile-wallet-adapter",
|
|
22
|
+
"create-app"
|
|
23
|
+
],
|
|
18
24
|
"author": "",
|
|
19
25
|
"license": "ISC",
|
|
20
26
|
"type": "commonjs",
|
|
21
27
|
"dependencies": {
|
|
22
28
|
"chalk": "^5.6.2",
|
|
23
29
|
"execa": "^9.6.1",
|
|
24
|
-
"expo": "^55.0.8",
|
|
25
30
|
"fs-extra": "^11.3.4",
|
|
26
31
|
"ora": "^9.3.0"
|
|
27
32
|
}
|
package/template/solana-kit.d.ts
CHANGED
|
@@ -11,3 +11,72 @@ declare module "@solana/kit" {
|
|
|
11
11
|
decode(bytes: Uint8Array, offset?: number): string;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
declare module "@solana-mobile/mobile-wallet-adapter-protocol-web3js" {
|
|
16
|
+
type WalletAccount = Record<string, unknown>;
|
|
17
|
+
|
|
18
|
+
type AuthorizeResult = {
|
|
19
|
+
accounts?: WalletAccount[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type MobileWallet = {
|
|
23
|
+
authorize(params: {
|
|
24
|
+
chain?: string;
|
|
25
|
+
identity: {
|
|
26
|
+
name?: string;
|
|
27
|
+
uri?: string;
|
|
28
|
+
icon?: string;
|
|
29
|
+
};
|
|
30
|
+
}): Promise<AuthorizeResult>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export function transact<T>(
|
|
34
|
+
callback: (mobileWallet: MobileWallet) => Promise<T>,
|
|
35
|
+
): Promise<T>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare module "react" {
|
|
39
|
+
export type ReactNode = unknown;
|
|
40
|
+
export type SetStateAction<S> = S | ((prevState: S) => S);
|
|
41
|
+
export type Dispatch<A> = (value: A) => void;
|
|
42
|
+
|
|
43
|
+
export interface ProviderProps<T> {
|
|
44
|
+
value: T;
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface Provider<T> {
|
|
49
|
+
(props: ProviderProps<T>): unknown;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface Context<T> {
|
|
53
|
+
Provider: Provider<T>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function createContext<T>(defaultValue: T): Context<T>;
|
|
57
|
+
export function useMemo<T>(factory: () => T, deps: readonly unknown[]): T;
|
|
58
|
+
export function useState<S>(
|
|
59
|
+
initialState: S,
|
|
60
|
+
): [S, Dispatch<SetStateAction<S>>];
|
|
61
|
+
|
|
62
|
+
const React: {
|
|
63
|
+
createContext: typeof createContext;
|
|
64
|
+
useMemo: typeof useMemo;
|
|
65
|
+
useState: typeof useState;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default React;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare module "react/jsx-runtime" {
|
|
72
|
+
export namespace JSX {
|
|
73
|
+
type Element = unknown;
|
|
74
|
+
interface IntrinsicElements {
|
|
75
|
+
[elemName: string]: unknown;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const Fragment: unique symbol;
|
|
80
|
+
export function jsx(type: unknown, props: unknown, key?: unknown): unknown;
|
|
81
|
+
export function jsxs(type: unknown, props: unknown, key?: unknown): unknown;
|
|
82
|
+
}
|