@iqlabs-official/git-sdk 0.1.0 → 0.1.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 +67 -36
- package/package.json +20 -8
package/README.md
CHANGED
|
@@ -1,49 +1,80 @@
|
|
|
1
|
-
# @iqlabs/git
|
|
1
|
+
# @iqlabs-official/git-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Embed on-chain Git into your Solana dApp. Browser SDK for letting users browse, create, and commit to repositories from your website, with a Node entry for tooling.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @iqlabs-official/git-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer deps: `@solana/web3.js`, `@iqlabs-official/solana-sdk` (aliased as `iqlabs-sdk`), `buffer`.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
- 글로벌 TODO: [../iq-git-cli/IQGIT-V2-TODO.md](../iq-git-cli/IQGIT-V2-TODO.md)
|
|
11
|
-
- 코드 법칙: [../iq-git-cli/CODE-RULES.md](../iq-git-cli/CODE-RULES.md)
|
|
12
|
-
- 본 repo TODO: [./TODO.md](./TODO.md)
|
|
15
|
+
### Browser (frontend / dApp)
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
```ts
|
|
18
|
+
import { GitClient, readRegistryPage } from "@iqlabs-official/git-sdk/browser";
|
|
19
|
+
import { useConnection, useWallet } from "@solana/wallet-adapter-react";
|
|
15
20
|
|
|
21
|
+
const { connection } = useConnection();
|
|
22
|
+
const wallet = useWallet();
|
|
23
|
+
|
|
24
|
+
// Read-only — no wallet required.
|
|
25
|
+
const entries = await readRegistryPage(connection, { limit: 50 });
|
|
26
|
+
|
|
27
|
+
// Write — needs a connected wallet adapter.
|
|
28
|
+
const client = new GitClient({
|
|
29
|
+
connection,
|
|
30
|
+
signer: {
|
|
31
|
+
publicKey: wallet.publicKey!,
|
|
32
|
+
signTransaction: wallet.signTransaction!,
|
|
33
|
+
signAllTransactions: wallet.signAllTransactions!,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
await client.createRepo({
|
|
38
|
+
name: "my-repo",
|
|
39
|
+
description: "hello on-chain",
|
|
40
|
+
isPublic: true,
|
|
41
|
+
timestamp: Date.now(),
|
|
42
|
+
});
|
|
16
43
|
```
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
scripts/
|
|
30
|
-
└─ bootstrap-registry.ts ← git_repos:all createTable (admin, 1회)
|
|
44
|
+
|
|
45
|
+
### Node (CLI / scripts)
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { GitClient } from "@iqlabs-official/git-sdk/node";
|
|
49
|
+
import { Connection, Keypair } from "@solana/web3.js";
|
|
50
|
+
|
|
51
|
+
const connection = new Connection(process.env.SOLANA_RPC_ENDPOINT!);
|
|
52
|
+
const signer = Keypair.fromSecretKey(/* your secret key */);
|
|
53
|
+
const client = new GitClient({ connection, signer });
|
|
54
|
+
|
|
55
|
+
await client.commit("my-repo", "initial", scan);
|
|
31
56
|
```
|
|
32
57
|
|
|
33
|
-
##
|
|
58
|
+
## API surface
|
|
34
59
|
|
|
35
|
-
`
|
|
60
|
+
- `GitClient` — high-level workflows: `createRepo`, `commit`, `checkout`, `clone`, `log`, `status`.
|
|
61
|
+
- `readOwnerRepos`, `readRegistryPage` — owner repo list + public gallery.
|
|
62
|
+
- `readLatestCommit`, `readCommitHistory` — direct commit-table reads.
|
|
63
|
+
- `loadTree`, `loadBlob` — pull a stored `tree.json` or file blob by tx signature.
|
|
64
|
+
- `bootstrapRegistry` — one-time admin call to initialize the global registry table on a fresh network.
|
|
36
65
|
|
|
37
|
-
-
|
|
38
|
-
- `core/` 는 DOM / node fs 금지
|
|
39
|
-
- `browser.ts` 는 `@solana/wallet-adapter-base` (타입만) OK
|
|
40
|
-
- `node.ts` 는 `node:fs`, `node:crypto` OK
|
|
41
|
-
- 위반은 eslint `no-restricted-imports` 로 빌드 시 차단
|
|
66
|
+
`SignerInput` from `@iqlabs-official/solana-sdk` is accepted everywhere a signer is needed: a `Keypair`, a web3.js `Signer`, or a wallet adapter object with `signTransaction` / `signAllTransactions`.
|
|
42
67
|
|
|
43
|
-
##
|
|
68
|
+
## Subpath entries
|
|
44
69
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
70
|
+
| Import | When to use |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `@iqlabs-official/git-sdk` | Types and pure functions only. No SHA-256 backend installed. |
|
|
73
|
+
| `@iqlabs-official/git-sdk/browser` | Installs SubtleCrypto SHA-256. Use this in browser apps. |
|
|
74
|
+
| `@iqlabs-official/git-sdk/node` | Installs `node:crypto` SHA-256. Use this in CLI / server. |
|
|
75
|
+
|
|
76
|
+
Importing the appropriate platform entry exactly once is required before calling any function that hashes content (e.g. `commit`, `status`).
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iqlabs-official/git-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Embed on-chain Git into your Solana dApp. Browser SDK for letting users browse, create, and commit to repositories from your website, with a Node entry for tooling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"solana",
|
|
@@ -18,16 +18,28 @@
|
|
|
18
18
|
"./dist/browser/index.js"
|
|
19
19
|
],
|
|
20
20
|
"exports": {
|
|
21
|
-
".":
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/shared/index.d.ts",
|
|
23
|
+
"import": "./dist/shared/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./browser": {
|
|
26
|
+
"types": "./dist/browser/index.d.ts",
|
|
27
|
+
"import": "./dist/browser/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./node": {
|
|
30
|
+
"types": "./dist/node/index.d.ts",
|
|
31
|
+
"import": "./dist/node/index.js"
|
|
32
|
+
}
|
|
24
33
|
},
|
|
25
|
-
"files": [
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"README.md"
|
|
37
|
+
],
|
|
26
38
|
"scripts": {
|
|
27
|
-
"build":
|
|
39
|
+
"build": "tsup",
|
|
28
40
|
"typecheck": "tsc --noEmit",
|
|
29
|
-
"lint":
|
|
30
|
-
"test":
|
|
41
|
+
"lint": "eslint src --max-warnings=0",
|
|
42
|
+
"test": "vitest run"
|
|
31
43
|
},
|
|
32
44
|
"peerDependencies": {
|
|
33
45
|
"@solana/web3.js": "^1.98.0",
|