@iqlabs-official/git-sdk 0.1.13 → 0.1.15

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.
@@ -1,3 +1,4 @@
1
- export { Commit, FileTree, GitClient, GitClientConfig, IQGIT_ROOT_ID, IQPAGES_CONFIG_FILENAME, IQPAGES_DEPLOYED_HINT, IQPAGES_PROFILE_FILENAME, IQPAGES_ROOT_ID, PAGES_FEE_LAMPORTS, PAGES_FEE_RECIPIENT, PagesConfig, PagesDeployment, PagesProfile, REGISTRY_HINT, RegistryEntry, Repository, SessionSpeed, WriteEvent, bootstrapRegistry, commitTableHint, commitTablePda, deployPages, getGatewayUrls, isPagesDeployed, listPagesDeployments, loadBlob, loadTree, pagesDeployId, pagesTablePda, readCommitHistory, readLatestCommit, readOwnerRepos, readPagesConfig, readPagesProfile, readRegistryPage, repoListHint, setGatewayUrls, setNetwork, uploadBlob, uploadTree, writeCommit } from '../shared/index.js';
1
+ export { Commit, EthClientConfig, EthNetwork, FileTree, GitClient, GitClientConfig, GitSigner, IQGIT_ROOT_ID, IQPAGES_CONFIG_FILENAME, IQPAGES_DEPLOYED_HINT, IQPAGES_PROFILE_FILENAME, IQPAGES_ROOT_ID, NetworkToken, PAGES_FEE_LAMPORTS, PAGES_FEE_RECIPIENT, PAGES_FEE_RECIPIENT_EVM, PAGES_FEE_WEI, PagesConfig, PagesDeployment, PagesProfile, REGISTRY_HINT, RegistryEntry, Repository, SessionSpeed, SolanaClientConfig, SolanaNetwork, TableRef, WriteEvent, bootstrapRegistry, commitTableHint, commitTableRef, deployPages, getGatewayUrls, isPagesDeployed, listPagesDeployments, loadBlob, loadTree, pagesDeployId, pagesTableRef, readCommitHistory, readLatestCommit, readOwnerRepos, readPagesConfig, readPagesProfile, readRegistryPage, repoListHint, setGatewayUrls, setNetwork, uploadBlob, uploadTree, writeCommit } from '../shared/index.js';
2
2
  export { DEFAULT_SESSION_SPEED, SESSION_SPEED_PROFILES, SignerInput, resolveSessionSpeed } from '@iqlabs-official/solana-sdk/utils';
3
3
  import '@solana/web3.js';
4
+ import 'ethers';
@@ -1,29 +1,6 @@
1
- import { setRpcUrl, getRpcUrl } from '@iqlabs-official/solana-sdk';
2
- import { Transaction, SystemProgram, PublicKey, Keypair } from '@solana/web3.js';
3
- import { getDbRootPda, getTablePda, createInstructionBuilder, initializeDbRootInstruction } from '@iqlabs-official/solana-sdk/contract';
4
- import { readTableRows, readCodeIn as readCodeIn$1 } from '@iqlabs-official/solana-sdk/reader';
5
- import { toSeedBytes } from '@iqlabs-official/solana-sdk/utils';
6
- export { DEFAULT_SESSION_SPEED, SESSION_SPEED_PROFILES, resolveSessionSpeed } from '@iqlabs-official/solana-sdk/utils';
7
- import { writeRow, createTable, codeIn as codeIn$1 } from '@iqlabs-official/solana-sdk/writer';
8
-
9
- // src/core/hash.ts
10
- var impl;
11
- function setSha256(fn) {
12
- if (impl) {
13
- throw new Error(
14
- "@iqlabs-official/git-sdk: sha256 implementation already installed. Import exactly one of '@iqlabs-official/git-sdk/node' or '@iqlabs-official/git-sdk/browser'."
15
- );
16
- }
17
- impl = fn;
18
- }
19
- async function sha256Hex(input) {
20
- if (!impl) {
21
- throw new Error(
22
- "@iqlabs-official/git-sdk: sha256 not installed. Import '@iqlabs-official/git-sdk/node' (Node) or '@iqlabs-official/git-sdk/browser' (browser) before using the SDK."
23
- );
24
- }
25
- return impl(input);
26
- }
1
+ import { setSha256 } from '../chunk-EZNMA5NJ.js';
2
+ export { DEFAULT_SESSION_SPEED, GitClient, SESSION_SPEED_PROFILES, bootstrapRegistry, commitTableRef, deployPages, isPagesDeployed, listPagesDeployments, loadBlob, loadTree, pagesTableRef, readCommitHistory, readLatestCommit, readOwnerRepos, readPagesConfig, readPagesProfile, readRegistryPage, resolveSessionSpeed, setNetwork, uploadBlob, uploadTree, writeCommit } from '../chunk-EZNMA5NJ.js';
3
+ export { IQGIT_ROOT_ID, IQPAGES_CONFIG_FILENAME, IQPAGES_DEPLOYED_HINT, IQPAGES_PROFILE_FILENAME, IQPAGES_ROOT_ID, PAGES_FEE_LAMPORTS, PAGES_FEE_RECIPIENT, PAGES_FEE_RECIPIENT_EVM, PAGES_FEE_WEI, REGISTRY_HINT, commitTableHint, getGatewayUrls, pagesDeployId, repoListHint, setGatewayUrls } from '../chunk-WHYUXIRW.js';
27
4
 
28
5
  // src/platform/hash-browser.ts
29
6
  var hashBrowser = async (input) => {
@@ -35,532 +12,7 @@ var hashBrowser = async (input) => {
35
12
  return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
36
13
  };
37
14
 
38
- // src/core/seed.ts
39
- var IQGIT_ROOT_ID = "iq-git-v1";
40
- var REGISTRY_HINT = "git_repos:all";
41
- function repoListHint(owner) {
42
- return `git_repos_v2_${owner}`;
43
- }
44
- function commitTableHint(owner, repo) {
45
- return `git_commits:${owner}:${repo}`;
46
- }
47
- var IQPAGES_ROOT_ID = "iqpages-root";
48
- var IQPAGES_DEPLOYED_HINT = "deployed";
49
- var PAGES_FEE_LAMPORTS = 2e8;
50
- var PAGES_FEE_RECIPIENT = "EWNSTD8tikwqHMcRNuuNbZrnYJUiJdKq9UXLXSEU4wZ1";
51
- var IQPAGES_CONFIG_FILENAME = "iqpages.json";
52
- var IQPAGES_PROFILE_FILENAME = "iqprofile.json";
53
- function pagesDeployId(owner, repo) {
54
- return `${owner}:${repo}`;
55
- }
56
- var MAINNET_GATEWAY = "https://gateway.iqlabs.dev";
57
- var DEVNET_GATEWAY = "https://dev-gateway.iqlabs.dev";
58
- var REQ_TIMEOUT_MS = 5e3;
59
- var runtimeGateways = null;
60
- var networkOverride = null;
61
- function setGatewayUrls(urls) {
62
- runtimeGateways = urls.length > 0 ? urls : null;
63
- }
64
- function setNetwork(network) {
65
- networkOverride = network;
66
- }
67
- function inferNetwork() {
68
- if (networkOverride) return networkOverride;
69
- const u = getRpcUrl().toLowerCase();
70
- if (u.includes("devnet") || u.includes("testnet")) return "devnet";
71
- return "mainnet";
72
- }
73
- function getGatewayUrls() {
74
- if (runtimeGateways) return runtimeGateways;
75
- const env = (typeof process !== "undefined" && process.env?.IQGIT_GATEWAYS) ?? "";
76
- if (env) return env.split(",").map((s) => s.trim()).filter(Boolean);
77
- return inferNetwork() === "devnet" ? [DEVNET_GATEWAY] : [MAINNET_GATEWAY];
78
- }
79
- async function tryGateways(path, parse) {
80
- for (const gw of getGatewayUrls()) {
81
- try {
82
- const ctrl = new AbortController();
83
- const timer = setTimeout(() => ctrl.abort(), REQ_TIMEOUT_MS);
84
- const res = await fetch(path(gw), { signal: ctrl.signal });
85
- clearTimeout(timer);
86
- if (res.ok) return await parse(res);
87
- } catch {
88
- }
89
- }
90
- return null;
91
- }
92
- async function readRowsViaGateway(pdaBase58, options) {
93
- const qs = new URLSearchParams();
94
- if (options?.limit) qs.set("limit", String(options.limit));
95
- if (options?.before) qs.set("before", options.before);
96
- const suffix = qs.toString() ? `?${qs}` : "";
97
- return tryGateways(
98
- (gw) => `${gw}/table/${pdaBase58}/rows${suffix}`,
99
- async (res) => {
100
- const json = await res.json();
101
- return json.rows ?? [];
102
- }
103
- );
104
- }
105
- async function readCodeInViaGateway(txSig) {
106
- return tryGateways(
107
- (gw) => `${gw}/data/${txSig}`,
108
- async (res) => {
109
- const json = await res.json();
110
- return { data: json.data ?? null, metadata: json.metadata ?? "" };
111
- }
112
- );
113
- }
114
- function notifyGateways(pdaBase58, txSig, row, signer) {
115
- const body = JSON.stringify({ txSignature: txSig, row, signer });
116
- for (const gw of getGatewayUrls()) {
117
- fetch(`${gw}/table/${pdaBase58}/notify`, {
118
- method: "POST",
119
- headers: { "content-type": "application/json" },
120
- body
121
- }).catch(() => {
122
- });
123
- }
124
- }
125
-
126
- // src/layers/chain.ts
127
- var DB_ROOT_SEED = toSeedBytes(IQGIT_ROOT_ID);
128
- var DB_ROOT = getDbRootPda(DB_ROOT_SEED);
129
- async function ensureDbRoot(connection, signer) {
130
- if (await accountExists(connection, DB_ROOT)) return null;
131
- const builder = createInstructionBuilder();
132
- const ix = initializeDbRootInstruction(
133
- builder,
134
- {
135
- db_root: DB_ROOT,
136
- signer: signer.publicKey,
137
- system_program: SystemProgram.programId
138
- },
139
- { db_root_id: DB_ROOT_SEED }
140
- );
141
- const tx = new Transaction().add(ix);
142
- const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
143
- tx.recentBlockhash = blockhash;
144
- tx.feePayer = signer.publicKey;
145
- const signed = await signTx(signer, tx);
146
- const signature = await connection.sendRawTransaction(signed.serialize());
147
- await connection.confirmTransaction({ signature, blockhash, lastValidBlockHeight });
148
- return signature;
149
- }
150
- async function signTx(signer, tx) {
151
- if (signer instanceof Keypair || "secretKey" in signer) {
152
- tx.partialSign(signer);
153
- return tx;
154
- }
155
- return signer.signTransaction(tx);
156
- }
157
- async function readRows(hint, options) {
158
- return readRowsByPda(tablePda(hint), options);
159
- }
160
- async function readRowsByPda(pda, options) {
161
- const viaGateway = await readRowsViaGateway(pda.toBase58(), options);
162
- if (viaGateway !== null) return viaGateway;
163
- return readTableRows(pda, options);
164
- }
165
- async function codeIn(connection, signer, data, filename, filetype, onProgress, speed = "light") {
166
- return codeIn$1(
167
- { connection, signer },
168
- data,
169
- filename,
170
- 0,
171
- filetype,
172
- onProgress,
173
- speed
174
- );
175
- }
176
- async function readCodeIn(txSig) {
177
- const viaGateway = await readCodeInViaGateway(txSig);
178
- if (viaGateway !== null) return viaGateway;
179
- return readCodeIn$1(txSig);
180
- }
181
- async function accountExists(connection, pda) {
182
- return await connection.getAccountInfo(pda) !== null;
183
- }
184
- function tablePda(hint) {
185
- return getTablePda(DB_ROOT, toSeedBytes(hint));
186
- }
187
- var COMMIT_COLUMNS = [
188
- "id",
189
- "message",
190
- "treeTxId",
191
- "parentCommitId",
192
- "timestamp",
193
- "author"
194
- ];
195
- async function ensureCommitTable(connection, signer, repo) {
196
- const hint = commitTableHint(signer.publicKey.toBase58(), repo);
197
- if (await accountExists(connection, tablePda(hint))) return null;
198
- return createTable(
199
- connection,
200
- signer,
201
- IQGIT_ROOT_ID,
202
- hint,
203
- hint,
204
- COMMIT_COLUMNS,
205
- "id",
206
- [],
207
- void 0,
208
- [signer.publicKey],
209
- hint
210
- );
211
- }
212
- async function writeCommit(connection, signer, repo, commit) {
213
- const owner = signer.publicKey.toBase58();
214
- const hint = commitTableHint(owner, repo);
215
- const sig = await writeRow(
216
- connection,
217
- signer,
218
- IQGIT_ROOT_ID,
219
- hint,
220
- JSON.stringify(commit)
221
- );
222
- notifyGateways(tablePda(hint).toBase58(), sig, commit, owner);
223
- return sig;
224
- }
225
- function commitTablePda(owner, repo) {
226
- return tablePda(commitTableHint(owner, repo));
227
- }
228
- async function readLatestCommit(pda) {
229
- const rows = await readRowsByPda(pda, { limit: 1 });
230
- return rows[0] ?? null;
231
- }
232
- async function readCommitHistory(pda, options) {
233
- const rows = await readRowsByPda(pda, options);
234
- return rows;
235
- }
236
- var REPO_COLUMNS = ["name", "description", "isPublic", "timestamp"];
237
- var REGISTRY_COLUMNS = ["owner", "repo", "description", "timestamp"];
238
- async function createRepo(connection, signer, meta) {
239
- const owner = signer.publicKey.toBase58();
240
- const listHint = repoListHint(owner);
241
- const writes = [];
242
- if (!await accountExists(connection, tablePda(listHint))) {
243
- await createTable(
244
- connection,
245
- signer,
246
- IQGIT_ROOT_ID,
247
- listHint,
248
- listHint,
249
- REPO_COLUMNS,
250
- "name",
251
- [],
252
- void 0,
253
- [signer.publicKey],
254
- listHint
255
- );
256
- }
257
- const sig = await writeRow(connection, signer, IQGIT_ROOT_ID, listHint, JSON.stringify(meta));
258
- writes.push({ tableHint: listHint, sig, row: meta });
259
- notifyGateways(tablePda(listHint).toBase58(), sig, meta, owner);
260
- if (meta.isPublic) {
261
- const entry = {
262
- owner,
263
- repo: meta.name,
264
- description: meta.description,
265
- timestamp: meta.timestamp
266
- };
267
- const regSig = await writeRow(connection, signer, IQGIT_ROOT_ID, REGISTRY_HINT, JSON.stringify(entry));
268
- writes.push({ tableHint: REGISTRY_HINT, sig: regSig, row: entry });
269
- notifyGateways(tablePda(REGISTRY_HINT).toBase58(), regSig, entry, owner);
270
- }
271
- return writes;
272
- }
273
- async function readOwnerRepos(_connection, owner) {
274
- return await readRows(repoListHint(owner));
275
- }
276
- async function readRegistryPage(_connection, options) {
277
- return await readRows(REGISTRY_HINT, options);
278
- }
279
- async function bootstrapRegistry(connection, signer) {
280
- await ensureDbRoot(connection, signer);
281
- if (await accountExists(connection, tablePda(REGISTRY_HINT))) {
282
- return null;
283
- }
284
- return createTable(
285
- connection,
286
- signer,
287
- IQGIT_ROOT_ID,
288
- REGISTRY_HINT,
289
- REGISTRY_HINT,
290
- REGISTRY_COLUMNS,
291
- "owner",
292
- [],
293
- void 0,
294
- void 0,
295
- REGISTRY_HINT
296
- );
297
- }
298
-
299
- // src/layers/storage.ts
300
- async function uploadBlob(connection, signer, relativePath, base64Content, reuse, onProgress, speed) {
301
- const hash = await sha256Hex(base64Content);
302
- const prior = reuse[relativePath];
303
- if (prior && prior.hash === hash) return prior;
304
- const basename = relativePath.split("/").pop() || relativePath;
305
- const txId = await codeIn(
306
- connection,
307
- signer,
308
- base64Content,
309
- `iqgit-blob:${basename}`,
310
- "application/octet-stream",
311
- onProgress,
312
- speed
313
- );
314
- return { txId, hash };
315
- }
316
- async function uploadTree(connection, signer, tree, speed) {
317
- return codeIn(
318
- connection,
319
- signer,
320
- JSON.stringify(tree),
321
- "iqgit-tree",
322
- "application/json",
323
- void 0,
324
- speed
325
- );
326
- }
327
- async function loadTree(treeTxId) {
328
- const { data } = await readCodeIn(treeTxId);
329
- if (data === null) {
330
- throw new Error(`tree.json not found for tx ${treeTxId}`);
331
- }
332
- return JSON.parse(data);
333
- }
334
- async function loadBlob(txId) {
335
- const { data } = await readCodeIn(txId);
336
- if (data === null) {
337
- throw new Error(`blob not found for tx ${txId}`);
338
- }
339
- return data;
340
- }
341
-
342
- // src/layers/client.ts
343
- var GitClient = class {
344
- // CODE-RULES §3 — only one small shape; inlined rather than aliased.
345
- constructor(cfg) {
346
- this.cfg = cfg;
347
- setRpcUrl(cfg.connection.rpcEndpoint);
348
- }
349
- cfg;
350
- /**
351
- * Create a new repo. Wraps repo.createRepo + pre-creating the commit table
352
- * so the first `commit()` call doesn't need to pay createTable cost.
353
- */
354
- async createRepo(meta) {
355
- const { connection, signer } = this.cfg;
356
- const writes = await createRepo(connection, signer, meta);
357
- await ensureCommitTable(connection, signer, meta.name);
358
- this.fireOnWrite(writes);
359
- }
360
- /**
361
- * Incremental commit against a scanned directory snapshot.
362
- *
363
- * input: repoName, message, scan — a `{ [path]: base64Content }` map that
364
- * the caller produced (Node: fs walk + base64; browser: File input).
365
- * output: newly written Commit
366
- */
367
- async commit(repoName, message, scan, options) {
368
- const { connection, signer } = this.cfg;
369
- const owner = signer.publicKey.toBase58();
370
- const speed = options?.speed ?? this.cfg.speed;
371
- const latest = await readLatestCommit(commitTablePda(owner, repoName));
372
- const oldTree = latest ? await loadTree(latest.treeTxId) : {};
373
- const newTree = {};
374
- for (const [path, content] of Object.entries(scan)) {
375
- newTree[path] = await uploadBlob(
376
- connection,
377
- signer,
378
- path,
379
- content,
380
- oldTree,
381
- void 0,
382
- speed
383
- );
384
- }
385
- const treeTxId = await uploadTree(connection, signer, newTree, speed);
386
- const commit = {
387
- id: crypto.randomUUID(),
388
- message,
389
- treeTxId,
390
- parentCommitId: latest?.id,
391
- timestamp: Date.now(),
392
- author: owner
393
- };
394
- const sig = await writeCommit(connection, signer, repoName, commit);
395
- this.fireOnWrite([{ tableHint: commitTableHint(owner, repoName), sig, row: commit }]);
396
- return commit;
397
- }
398
- /** Resolve the table hint to a PDA and forward each write to `onWrite`.
399
- * Wrapped in try/catch per call so a misbehaving notify can't fail the
400
- * whole batch — but we still surface the error so the consumer knows. */
401
- fireOnWrite(writes) {
402
- if (!this.cfg.onWrite) return;
403
- for (const w of writes) {
404
- const tablePda2 = tablePda(w.tableHint).toBase58();
405
- this.cfg.onWrite({ tablePda: tablePda2, tableHint: w.tableHint, sig: w.sig, row: w.row });
406
- }
407
- }
408
- /**
409
- * Restore a commit's files into a caller-provided sink. Runtime-neutral
410
- * shape mirrors `commit`: the caller decides how to write bytes to disk /
411
- * to a File System Access API handle / anywhere else. `content` is the
412
- * raw base64 string — the sink decodes.
413
- */
414
- async checkout(repoName, commitId, sink) {
415
- const { connection, signer } = this.cfg;
416
- const owner = signer.publicKey.toBase58();
417
- const pda = commitTablePda(owner, repoName);
418
- let target;
419
- if (commitId === "latest") {
420
- target = await readLatestCommit(pda);
421
- } else {
422
- const history = await readCommitHistory(pda);
423
- target = history.find((c) => c.id === commitId) ?? null;
424
- }
425
- if (!target) {
426
- throw new Error(`commit not found: ${commitId} in ${owner}/${repoName}`);
427
- }
428
- const tree = await loadTree(target.treeTxId);
429
- for (const [path, entry] of Object.entries(tree)) {
430
- const content = await loadBlob(entry.txId);
431
- await sink(path, content);
432
- }
433
- return target;
434
- }
435
- /**
436
- * Whole-repo snapshot download — convenience on top of checkout("latest")
437
- * but reading from someone else's `owner`. We do not require signer to
438
- * equal owner for reads.
439
- */
440
- async clone(repoName, owner, sink) {
441
- const target = await readLatestCommit(commitTablePda(owner, repoName));
442
- if (!target) {
443
- throw new Error(`no commits in ${owner}/${repoName}`);
444
- }
445
- const tree = await loadTree(target.treeTxId);
446
- for (const [path, entry] of Object.entries(tree)) {
447
- const content = await loadBlob(entry.txId);
448
- await sink(path, content);
449
- }
450
- return target;
451
- }
452
- /** Commit history for a repo. */
453
- async log(owner, repoName, options) {
454
- return readCommitHistory(commitTablePda(owner, repoName), options);
455
- }
456
- /**
457
- * Compare a current directory snapshot to the latest commit's tree.
458
- */
459
- async status(owner, repoName, scan) {
460
- const latest = await readLatestCommit(commitTablePda(owner, repoName));
461
- const tree = latest ? await loadTree(latest.treeTxId) : {};
462
- const added = [];
463
- const modified = [];
464
- const unchanged = [];
465
- for (const [path, content] of Object.entries(scan)) {
466
- const prior = tree[path];
467
- if (!prior) {
468
- added.push(path);
469
- continue;
470
- }
471
- const hash = await sha256Hex(content);
472
- (prior.hash === hash ? unchanged : modified).push(path);
473
- }
474
- return { added, modified, unchanged };
475
- }
476
- };
477
- function pagesTablePda() {
478
- const dbRoot = getDbRootPda(toSeedBytes(IQPAGES_ROOT_ID));
479
- return getTablePda(dbRoot, toSeedBytes(IQPAGES_DEPLOYED_HINT));
480
- }
481
- async function listPagesDeployments() {
482
- const pda = pagesTablePda().toBase58();
483
- const viaGateway = await readRowsViaGateway(pda);
484
- const rows = viaGateway ?? await readTableRows(pda);
485
- return rows;
486
- }
487
- async function isPagesDeployed(owner, repo) {
488
- const id = pagesDeployId(owner, repo);
489
- const all = await listPagesDeployments();
490
- return all.some((r) => r.id === id);
491
- }
492
- async function readJsonFromLatest(owner, repo, filename) {
493
- const latest = await readLatestCommit(commitTablePda(owner, repo));
494
- if (!latest) return null;
495
- const tree = await loadTree(latest.treeTxId);
496
- const entry = tree[filename];
497
- if (!entry?.txId) return null;
498
- const base64 = await loadBlob(entry.txId);
499
- return JSON.parse(Buffer.from(base64, "base64").toString("utf8"));
500
- }
501
- async function readPagesConfig(owner, repo) {
502
- return readJsonFromLatest(owner, repo, IQPAGES_CONFIG_FILENAME);
503
- }
504
- async function readPagesProfile(owner, repo) {
505
- return readJsonFromLatest(owner, repo, IQPAGES_PROFILE_FILENAME);
506
- }
507
- async function deployPages(connection, signer, repo) {
508
- const owner = signer.publicKey.toBase58();
509
- if (await isPagesDeployed(owner, repo)) {
510
- throw new Error(`already deployed: ${owner}/${repo}`);
511
- }
512
- const config = await readPagesConfig(owner, repo);
513
- if (!config) {
514
- throw new Error(
515
- `${IQPAGES_CONFIG_FILENAME} missing in ${repo}. Commit it first, then deploy.`
516
- );
517
- }
518
- const balance = await connection.getBalance(signer.publicKey);
519
- const needed = PAGES_FEE_LAMPORTS + 5e7;
520
- if (balance < needed) {
521
- throw new Error(
522
- `insufficient balance: have ${balance / 1e9} SOL, need at least ${needed / 1e9} SOL`
523
- );
524
- }
525
- const row = {
526
- id: pagesDeployId(owner, repo),
527
- owner,
528
- repo,
529
- deployedAt: Date.now()
530
- };
531
- const sig = await writeRow(
532
- connection,
533
- signer,
534
- IQPAGES_ROOT_ID,
535
- IQPAGES_DEPLOYED_HINT,
536
- JSON.stringify(row)
537
- );
538
- notifyGateways(pagesTablePda().toBase58(), sig, row, owner);
539
- await transferFee(connection, signer);
540
- return { sig, config };
541
- }
542
- async function transferFee(connection, signer) {
543
- const tx = new Transaction().add(
544
- SystemProgram.transfer({
545
- fromPubkey: signer.publicKey,
546
- toPubkey: new PublicKey(PAGES_FEE_RECIPIENT),
547
- lamports: PAGES_FEE_LAMPORTS
548
- })
549
- );
550
- tx.feePayer = signer.publicKey;
551
- const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
552
- tx.recentBlockhash = blockhash;
553
- const signed = await signTx(signer, tx);
554
- const feeSig = await connection.sendRawTransaction(signed.serialize());
555
- await connection.confirmTransaction(
556
- { signature: feeSig, blockhash, lastValidBlockHeight },
557
- "confirmed"
558
- );
559
- }
560
-
561
15
  // src/browser.ts
562
16
  setSha256(hashBrowser);
563
-
564
- export { GitClient, IQGIT_ROOT_ID, IQPAGES_CONFIG_FILENAME, IQPAGES_DEPLOYED_HINT, IQPAGES_PROFILE_FILENAME, IQPAGES_ROOT_ID, PAGES_FEE_LAMPORTS, PAGES_FEE_RECIPIENT, REGISTRY_HINT, bootstrapRegistry, commitTableHint, commitTablePda, deployPages, getGatewayUrls, isPagesDeployed, listPagesDeployments, loadBlob, loadTree, pagesDeployId, pagesTablePda, readCommitHistory, readLatestCommit, readOwnerRepos, readPagesConfig, readPagesProfile, readRegistryPage, repoListHint, setGatewayUrls, setNetwork, uploadBlob, uploadTree, writeCommit };
565
17
  //# sourceMappingURL=index.js.map
566
18
  //# sourceMappingURL=index.js.map