@typesol/cli 0.31.0 → 0.32.0
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/CHANGELOG.md +38 -0
- package/README.md +8 -7
- package/dist/cli.js +50 -5
- package/dist/compiler/analyze.js +14 -5
- package/dist/compiler/emit/base.d.ts +1 -0
- package/dist/compiler/emit/calls.d.ts +2 -0
- package/dist/compiler/emit/calls.js +93 -11
- package/dist/compiler/emit/cpi-core.d.ts +8 -0
- package/dist/compiler/emit/cpi-core.js +15 -0
- package/dist/compiler/emit/cpi.js +10 -4
- package/dist/compiler/emit/create.d.ts +2 -0
- package/dist/compiler/emit/create.js +56 -13
- package/dist/compiler/emit/expressions.js +6 -2
- package/dist/compiler/emit/statements.js +15 -0
- package/dist/compiler/emit/token.js +43 -0
- package/dist/templates.js +13 -36
- package/dist/testing.d.ts +30 -0
- package/dist/testing.js +64 -2
- package/dist/workspace.d.ts +16 -1
- package/dist/workspace.js +49 -5
- package/docs/audit.md +1 -1
- package/docs/case-study-escrow.md +3 -3
- package/docs/case-study-multisig.md +3 -3
- package/docs/case-study-raydium-cp-swap.md +51 -21
- package/docs/cli.md +5 -3
- package/docs/errors.md +3 -1
- package/docs/language.md +12 -5
- package/docs/migrate-from-anchor.md +3 -0
- package/docs/test-your-program.md +12 -3
- package/docs/testing.md +1 -1
- package/lib/typesol.d.ts +28 -5
- package/package.json +1 -1
- package/runtime/typesol_rt.h +65 -7
|
@@ -69,6 +69,10 @@ export class StatementEmitter extends CpiEmitter {
|
|
|
69
69
|
return this.doLoop(stmt);
|
|
70
70
|
if (ts.isForInStatement(stmt))
|
|
71
71
|
this.fail(stmt, "for … in is not supported: use for (init; cond; step), for (const x of list), while or do … while");
|
|
72
|
+
if (ts.isThrowStatement(stmt))
|
|
73
|
+
this.fail(stmt, 'throw is not supported: fail the instruction with require(false, ErrorCode.X) or require(cond, "message")');
|
|
74
|
+
if (ts.isTryStatement(stmt))
|
|
75
|
+
this.fail(stmt, "try/catch is not supported: a failed check or CPI aborts the whole instruction, so check first with require(…)");
|
|
72
76
|
this.fail(stmt, `${ts.SyntaxKind[stmt.kind]} is not supported in TypeSOL`);
|
|
73
77
|
}
|
|
74
78
|
returnStatement(stmt) {
|
|
@@ -897,6 +901,17 @@ export class StatementEmitter extends CpiEmitter {
|
|
|
897
901
|
continue;
|
|
898
902
|
}
|
|
899
903
|
const fn = ts.isCallExpression(init) ? this.exportName(init.expression) : undefined;
|
|
904
|
+
// A seed list to sign with more than once: `const vault = signer(["vault", owner.key, bump])`.
|
|
905
|
+
if (fn === "signer") {
|
|
906
|
+
if (mutable)
|
|
907
|
+
this.fail(d, "bind seed lists with const");
|
|
908
|
+
const s = this.signerSeedsArg(init);
|
|
909
|
+
this.line(`const SolSignerSeed *${c} = ${s.name};`);
|
|
910
|
+
this.line(`int ${c}__n = ${s.count};`);
|
|
911
|
+
this.line(`(void)${c}; (void)${c}__n;`);
|
|
912
|
+
this.scopes.at(-1).set(name, { c, type: { kind: "signerSeeds" }, mutable: false });
|
|
913
|
+
continue;
|
|
914
|
+
}
|
|
900
915
|
if (fn === "fixedArray") {
|
|
901
916
|
const t = this.localArray(init, c);
|
|
902
917
|
this.scopes.at(-1).set(name, { c, type: t, mutable });
|
|
@@ -114,6 +114,7 @@ export class TokenEmitter extends CreateEmitter {
|
|
|
114
114
|
const optKey = { kind: "option", inner: PUBKEY };
|
|
115
115
|
const U16 = { kind: "int", name: "u16" };
|
|
116
116
|
const I16 = { kind: "int", name: "i16" };
|
|
117
|
+
const decimals = (mint) => (put) => put(`&a_${mint.name}->data[44]`, "1", 1);
|
|
117
118
|
const byte = (k) => (put) => {
|
|
118
119
|
const t = this.tmp("b");
|
|
119
120
|
this.line(`uint8_t ${t} = ${k};`);
|
|
@@ -406,6 +407,48 @@ export class TokenEmitter extends CreateEmitter {
|
|
|
406
407
|
], s);
|
|
407
408
|
return undefined;
|
|
408
409
|
}
|
|
410
|
+
// The checked forms take the decimals from the mint, as transferChecked does.
|
|
411
|
+
case "approveChecked": {
|
|
412
|
+
arity(5);
|
|
413
|
+
const src = want(a[0], "token", true, "the source");
|
|
414
|
+
const mint = want(a[1], "mint", false, "the mint");
|
|
415
|
+
const delegate = this.accountParam(a[2], "the delegate");
|
|
416
|
+
const owner = this.accountParam(a[3], "the owner");
|
|
417
|
+
const s = this.signerSeeds(a[5], owner, a[3]);
|
|
418
|
+
simple(13, [value(a[4], U64), decimals(mint)], [
|
|
419
|
+
[src, true, false],
|
|
420
|
+
[mint, false, false],
|
|
421
|
+
[delegate, false, false],
|
|
422
|
+
[owner, false, true],
|
|
423
|
+
], s);
|
|
424
|
+
return undefined;
|
|
425
|
+
}
|
|
426
|
+
case "mintToChecked": {
|
|
427
|
+
arity(4);
|
|
428
|
+
const mint = want(a[0], "mint", true, "the mint");
|
|
429
|
+
const to = want(a[1], "token", true, "the destination");
|
|
430
|
+
const auth = this.accountParam(a[2], "the mint authority");
|
|
431
|
+
const s = this.signerSeeds(a[4], auth, a[2]);
|
|
432
|
+
simple(14, [value(a[3], U64), decimals(mint)], [
|
|
433
|
+
[mint, true, false],
|
|
434
|
+
[to, true, false],
|
|
435
|
+
[auth, false, true],
|
|
436
|
+
], s);
|
|
437
|
+
return undefined;
|
|
438
|
+
}
|
|
439
|
+
case "burnChecked": {
|
|
440
|
+
arity(4);
|
|
441
|
+
const from = want(a[0], "token", true, "the burned account");
|
|
442
|
+
const mint = want(a[1], "mint", true, "the mint");
|
|
443
|
+
const auth = this.accountParam(a[2], "the authority");
|
|
444
|
+
const s = this.signerSeeds(a[4], auth, a[2]);
|
|
445
|
+
simple(15, [value(a[3], U64), decimals(mint)], [
|
|
446
|
+
[from, true, false],
|
|
447
|
+
[mint, true, false],
|
|
448
|
+
[auth, false, true],
|
|
449
|
+
], s);
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
409
452
|
case "revoke": {
|
|
410
453
|
arity(2);
|
|
411
454
|
const src = want(a[0], "token", true, "the source");
|
package/dist/templates.js
CHANGED
|
@@ -256,46 +256,24 @@ export function refund(
|
|
|
256
256
|
}
|
|
257
257
|
`,
|
|
258
258
|
test: (name) => testFile(name, {
|
|
259
|
-
imports: `import {
|
|
259
|
+
imports: `import { type Address, type KeyPairSigner } from "@solana/kit";\n`,
|
|
260
260
|
body: `
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const mint =
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return address;
|
|
268
|
-
};
|
|
269
|
-
/** A token account of owner for mint holding amount, written straight into the VM. */
|
|
270
|
-
const tokenAccount = async (owner: Address, mintAddress: Address, amount: bigint) => {
|
|
271
|
-
const address = (await generateKeyPairSigner()).address;
|
|
272
|
-
const data = getTokenEncoder().encode({
|
|
273
|
-
mint: mintAddress,
|
|
274
|
-
owner,
|
|
275
|
-
amount,
|
|
276
|
-
delegate: null,
|
|
277
|
-
state: AccountState.Initialized,
|
|
278
|
-
isNative: null,
|
|
279
|
-
delegatedAmount: 0n,
|
|
280
|
-
closeAuthority: null,
|
|
281
|
-
});
|
|
282
|
-
t.svm.setAccount({ address, data: new Uint8Array(data), executable: false, lamports: lamports(2_039_280n), programAddress: TOKEN, space: BigInt(getTokenSize()) });
|
|
283
|
-
return address;
|
|
284
|
-
};
|
|
285
|
-
const balance = (address: Address) => {
|
|
286
|
-
const account = t.svm.getAccount(address);
|
|
287
|
-
return account.exists ? getTokenDecoder().decode(account.data).amount : null;
|
|
288
|
-
};
|
|
261
|
+
// Mints and token accounts are written straight into the VM (a real client sends System CreateAccount and
|
|
262
|
+
// InitializeMint2 / InitializeAccount3).
|
|
263
|
+
const mint = (authority: KeyPairSigner) => t.mint({ authority: authority.address, decimals: 6 });
|
|
264
|
+
const tokenAccount = (owner: KeyPairSigner | Address, mintAddress: Address, amount: bigint) =>
|
|
265
|
+
t.tokenAccount({ owner: typeof owner === "string" ? owner : owner.address, mint: mintAddress, amount });
|
|
266
|
+
const balance = (address: Address) => t.tokenBalance(address);
|
|
289
267
|
|
|
290
268
|
it("escrows mint A for mint B; the taker swaps, the maker can refund", async () => {
|
|
291
269
|
const maker = await t.wallet();
|
|
292
270
|
const taker = await t.wallet();
|
|
293
|
-
const mintA = await mint(maker
|
|
294
|
-
const mintB = await mint(taker
|
|
295
|
-
const makerTokenA = await tokenAccount(maker
|
|
296
|
-
const makerTokenB = await tokenAccount(maker
|
|
297
|
-
const takerTokenA = await tokenAccount(taker
|
|
298
|
-
const takerTokenB = await tokenAccount(taker
|
|
271
|
+
const mintA = await mint(maker);
|
|
272
|
+
const mintB = await mint(taker);
|
|
273
|
+
const makerTokenA = await tokenAccount(maker, mintA, 1_000n);
|
|
274
|
+
const makerTokenB = await tokenAccount(maker, mintB, 0n);
|
|
275
|
+
const takerTokenA = await tokenAccount(taker, mintA, 0n);
|
|
276
|
+
const takerTokenB = await tokenAccount(taker, mintB, 500n);
|
|
299
277
|
|
|
300
278
|
const open = async (seed: bigint) => {
|
|
301
279
|
const offer = await t.pda("offer", maker, seed);
|
|
@@ -319,6 +297,5 @@ export function refund(
|
|
|
319
297
|
});
|
|
320
298
|
`,
|
|
321
299
|
}),
|
|
322
|
-
devDependencies: { "@solana-program/token": "~0.18.0" },
|
|
323
300
|
},
|
|
324
301
|
};
|
package/dist/testing.d.ts
CHANGED
|
@@ -62,6 +62,36 @@ export interface TestProgram {
|
|
|
62
62
|
balance(address: Address): bigint;
|
|
63
63
|
/** A kit RPC and subscriptions pair over this LiteSVM, for the generated client (`svmConnection`). */
|
|
64
64
|
connection: SvmConnection;
|
|
65
|
+
/** The name of an error code: the program's own (6000+), TypeSOL's or Anchor's; undefined for others. */
|
|
66
|
+
errorName(code: number): string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* A mint written straight into the VM (as System CreateAccount + InitializeMint2 would leave it). SPL Token unless
|
|
69
|
+
* `tokenProgram` is Token-2022; no extensions.
|
|
70
|
+
*/
|
|
71
|
+
mint(opts: {
|
|
72
|
+
authority: Address;
|
|
73
|
+
decimals?: number;
|
|
74
|
+
supply?: bigint;
|
|
75
|
+
freezeAuthority?: Address;
|
|
76
|
+
tokenProgram?: Address;
|
|
77
|
+
address?: Address;
|
|
78
|
+
}): Promise<Address>;
|
|
79
|
+
/** A token account of `owner` for `mint` holding `amount`, written straight into the VM (at `address`, e.g. an ATA). */
|
|
80
|
+
tokenAccount(opts: {
|
|
81
|
+
mint: Address;
|
|
82
|
+
owner: Address;
|
|
83
|
+
amount?: bigint;
|
|
84
|
+
tokenProgram?: Address;
|
|
85
|
+
address?: Address;
|
|
86
|
+
}): Promise<Address>;
|
|
87
|
+
/** The amount a token account holds, or null when it does not exist. */
|
|
88
|
+
tokenBalance(address: Address): bigint | null;
|
|
89
|
+
/** Move the Clock: to a unix timestamp and/or a slot, or forward by `seconds`. */
|
|
90
|
+
warp(to: {
|
|
91
|
+
unixTimestamp?: bigint;
|
|
92
|
+
slot?: bigint;
|
|
93
|
+
seconds?: bigint;
|
|
94
|
+
}): void;
|
|
65
95
|
}
|
|
66
96
|
/** Build `program` of the project around `from` (a file URL such as import.meta.url, or a directory) and load it. */
|
|
67
97
|
export declare function testProgram(program: string, from: string | URL): Promise<TestProgram>;
|
package/dist/testing.js
CHANGED
|
@@ -22,6 +22,7 @@ import { FailedTransactionMetadata, LiteSVM } from "litesvm";
|
|
|
22
22
|
import { createHash } from "node:crypto";
|
|
23
23
|
import path from "node:path";
|
|
24
24
|
import { fileURLToPath } from "node:url";
|
|
25
|
+
import { TYPESOL_ERRORS } from "./tools/clientgen.js";
|
|
25
26
|
import { svmConnection } from "./tools/svmrpc.js";
|
|
26
27
|
import { buildWorkspace, findWorkspace } from "./workspace.js";
|
|
27
28
|
export { svmConnection };
|
|
@@ -31,6 +32,7 @@ const BIG = new Set(["u64", "i64", "u128", "i128"]);
|
|
|
31
32
|
const snake = (s) => s.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
|
|
32
33
|
const camel = (s) => s.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
33
34
|
const isSigner = (v) => typeof v === "object" && v !== null && "address" in v && "signTransactions" in v;
|
|
35
|
+
const TOKEN_PROGRAM = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
34
36
|
/** Build `program` of the project around `from` (a file URL such as import.meta.url, or a directory) and load it. */
|
|
35
37
|
export async function testProgram(program, from) {
|
|
36
38
|
const start = typeof from === "string" && !from.startsWith("file:") ? from : path.dirname(fileURLToPath(from));
|
|
@@ -289,8 +291,11 @@ export function programHarness(svm, programId, idl) {
|
|
|
289
291
|
return res;
|
|
290
292
|
},
|
|
291
293
|
ok(res) {
|
|
292
|
-
if (res instanceof FailedTransactionMetadata)
|
|
293
|
-
|
|
294
|
+
if (res instanceof FailedTransactionMetadata) {
|
|
295
|
+
const m = /Custom\D*(\d+)/.exec(String(res.err()));
|
|
296
|
+
const name = m ? harness.errorName(Number(m[1])) : undefined;
|
|
297
|
+
throw new Error(`transaction failed: ${String(res.err())}${name ? ` (${name})` : ""}\n${res.meta().logs().join("\n")}`);
|
|
298
|
+
}
|
|
294
299
|
return res;
|
|
295
300
|
},
|
|
296
301
|
errorCode(res) {
|
|
@@ -301,6 +306,63 @@ export function programHarness(svm, programId, idl) {
|
|
|
301
306
|
throw new Error(`not a custom program error: ${String(res.err())}\n${res.meta().logs().join("\n")}`);
|
|
302
307
|
return Number(m[1]);
|
|
303
308
|
},
|
|
309
|
+
errorName(code) {
|
|
310
|
+
return pidl.errors?.find((e) => e.code === code)?.name ?? TYPESOL_ERRORS[code];
|
|
311
|
+
},
|
|
312
|
+
async mint({ authority, decimals = 6, supply = 0n, freezeAuthority, tokenProgram = TOKEN_PROGRAM, address }) {
|
|
313
|
+
const at = address ?? (await generateKeyPairSigner()).address;
|
|
314
|
+
const data = new Uint8Array(82);
|
|
315
|
+
const view = new DataView(data.buffer);
|
|
316
|
+
view.setUint32(0, 1, true);
|
|
317
|
+
data.set(enc.encode(authority), 4);
|
|
318
|
+
view.setBigUint64(36, supply, true);
|
|
319
|
+
data[44] = decimals;
|
|
320
|
+
data[45] = 1;
|
|
321
|
+
if (freezeAuthority) {
|
|
322
|
+
view.setUint32(46, 1, true);
|
|
323
|
+
data.set(enc.encode(freezeAuthority), 50);
|
|
324
|
+
}
|
|
325
|
+
svm.setAccount({
|
|
326
|
+
address: at,
|
|
327
|
+
data,
|
|
328
|
+
executable: false,
|
|
329
|
+
lamports: lamports(svm.minimumBalanceForRentExemption(82n)),
|
|
330
|
+
programAddress: tokenProgram,
|
|
331
|
+
space: 82n,
|
|
332
|
+
});
|
|
333
|
+
return at;
|
|
334
|
+
},
|
|
335
|
+
async tokenAccount({ mint, owner, amount = 0n, tokenProgram = TOKEN_PROGRAM, address }) {
|
|
336
|
+
const at = address ?? (await generateKeyPairSigner()).address;
|
|
337
|
+
const data = new Uint8Array(165);
|
|
338
|
+
data.set(enc.encode(mint), 0);
|
|
339
|
+
data.set(enc.encode(owner), 32);
|
|
340
|
+
new DataView(data.buffer).setBigUint64(64, amount, true);
|
|
341
|
+
data[108] = 1; // AccountState::Initialized
|
|
342
|
+
svm.setAccount({
|
|
343
|
+
address: at,
|
|
344
|
+
data,
|
|
345
|
+
executable: false,
|
|
346
|
+
lamports: lamports(svm.minimumBalanceForRentExemption(165n)),
|
|
347
|
+
programAddress: tokenProgram,
|
|
348
|
+
space: 165n,
|
|
349
|
+
});
|
|
350
|
+
return at;
|
|
351
|
+
},
|
|
352
|
+
tokenBalance(address) {
|
|
353
|
+
const a = svm.getAccount(address);
|
|
354
|
+
return a.exists && a.data.length >= 72 ? new DataView(a.data.buffer, a.data.byteOffset).getBigUint64(64, true) : null;
|
|
355
|
+
},
|
|
356
|
+
warp({ unixTimestamp, slot, seconds }) {
|
|
357
|
+
const clock = svm.getClock();
|
|
358
|
+
if (slot !== undefined)
|
|
359
|
+
clock.slot = slot;
|
|
360
|
+
if (unixTimestamp !== undefined)
|
|
361
|
+
clock.unixTimestamp = unixTimestamp;
|
|
362
|
+
if (seconds !== undefined)
|
|
363
|
+
clock.unixTimestamp += seconds;
|
|
364
|
+
svm.setClock(clock);
|
|
365
|
+
},
|
|
304
366
|
async account(type, address) {
|
|
305
367
|
const a = svm.getAccount(address);
|
|
306
368
|
if (!a.exists)
|
package/dist/workspace.d.ts
CHANGED
|
@@ -26,19 +26,26 @@ export declare function programForEntry(ws: Workspace, file: string): string | u
|
|
|
26
26
|
/**
|
|
27
27
|
* The program's keypair (created on first use) checked against the address recorded in typesol.json, which is
|
|
28
28
|
* recorded on first build. A mismatch means the keypair was lost or replaced: deploying would create a new program.
|
|
29
|
+
* Building and testing only need the address: without the keypair (a fresh clone, CI) they use the recorded one,
|
|
30
|
+
* and only deploying (`needKeypair`) refuses.
|
|
29
31
|
*/
|
|
30
|
-
export declare function programAddress(ws: Workspace, name: string
|
|
32
|
+
export declare function programAddress(ws: Workspace, name: string, opts?: {
|
|
33
|
+
needKeypair?: boolean;
|
|
34
|
+
}): {
|
|
31
35
|
address: string;
|
|
32
36
|
created: boolean;
|
|
37
|
+
keyless?: boolean;
|
|
33
38
|
};
|
|
34
39
|
/** Build every program (or the ones named). */
|
|
35
40
|
export declare function buildWorkspace(ws: Workspace, names?: string[], opts?: {
|
|
36
41
|
sbpf?: Sbpf;
|
|
37
42
|
profile?: boolean;
|
|
43
|
+
needKeypair?: boolean;
|
|
38
44
|
}): {
|
|
39
45
|
paths: ProgramPaths;
|
|
40
46
|
address: string;
|
|
41
47
|
created: boolean;
|
|
48
|
+
keyless?: boolean;
|
|
42
49
|
result: BuildResult;
|
|
43
50
|
clientPath: string;
|
|
44
51
|
}[];
|
|
@@ -50,3 +57,11 @@ export declare function deployArgs(soPath: string, keypair: string, opts: {
|
|
|
50
57
|
}): string[];
|
|
51
58
|
/** Create a project: typesol.json, one program from a template, its LiteSVM test, configs (editor settings included). Refuses to overwrite files. */
|
|
52
59
|
export declare function scaffold(dir: string, name: string, template?: TemplateName): string[];
|
|
60
|
+
/**
|
|
61
|
+
* Add a program to an existing project: programs/<name>.ts and tests/<name>.test.ts from a template, and its entry in
|
|
62
|
+
* typesol.json. Returns the files written and the template's extra devDependencies the package.json lacks.
|
|
63
|
+
*/
|
|
64
|
+
export declare function addProgram(ws: Workspace, name: string, template?: TemplateName): {
|
|
65
|
+
files: string[];
|
|
66
|
+
missing: string[];
|
|
67
|
+
};
|
package/dist/workspace.js
CHANGED
|
@@ -65,10 +65,14 @@ export function programForEntry(ws, file) {
|
|
|
65
65
|
/**
|
|
66
66
|
* The program's keypair (created on first use) checked against the address recorded in typesol.json, which is
|
|
67
67
|
* recorded on first build. A mismatch means the keypair was lost or replaced: deploying would create a new program.
|
|
68
|
+
* Building and testing only need the address: without the keypair (a fresh clone, CI) they use the recorded one,
|
|
69
|
+
* and only deploying (`needKeypair`) refuses.
|
|
68
70
|
*/
|
|
69
|
-
export function programAddress(ws, name) {
|
|
71
|
+
export function programAddress(ws, name, opts = {}) {
|
|
70
72
|
const paths = programPaths(ws, name);
|
|
71
73
|
const recorded = ws.programs[name].address;
|
|
74
|
+
if (recorded && !existsSync(paths.keypair) && !opts.needKeypair)
|
|
75
|
+
return { address: recorded, created: false, keyless: true };
|
|
72
76
|
if (recorded && !existsSync(paths.keypair))
|
|
73
77
|
throw new Error(`${name}: ${path.relative(ws.root, paths.keypair)} is missing, but ${CONFIG} records ${recorded}. Restore the keypair (it is the program's address); removing "address" from ${CONFIG} would give the program a new address.`);
|
|
74
78
|
mkdirSync(path.dirname(paths.keypair), { recursive: true });
|
|
@@ -87,11 +91,11 @@ export function programAddress(ws, name) {
|
|
|
87
91
|
export function buildWorkspace(ws, names = Object.keys(ws.programs), opts = {}) {
|
|
88
92
|
return names.map((name) => {
|
|
89
93
|
const paths = programPaths(ws, name);
|
|
90
|
-
const { address, created } = programAddress(ws, name);
|
|
94
|
+
const { address, created, keyless } = programAddress(ws, name, { needKeypair: opts.needKeypair });
|
|
91
95
|
const result = build(paths.entry, paths.outDir, address, { sbpf: opts.sbpf ?? ws.sbpf, profile: opts.profile });
|
|
92
96
|
// The TypeScript client (docs/client.md) is written with the build, from the same IDL.
|
|
93
97
|
const clientPath = writeClient(result.idl, path.join(paths.outDir, `${result.model.name}.client.ts`)).path;
|
|
94
|
-
return { paths, address, created, result, clientPath };
|
|
98
|
+
return { paths, address, created, keyless, result, clientPath };
|
|
95
99
|
});
|
|
96
100
|
}
|
|
97
101
|
/** The `solana program deploy` arguments for one built program (deploying again upgrades it). */
|
|
@@ -132,7 +136,15 @@ export function scaffold(dir, name, template = "counter") {
|
|
|
132
136
|
name,
|
|
133
137
|
private: true,
|
|
134
138
|
type: "module",
|
|
135
|
-
scripts: {
|
|
139
|
+
scripts: {
|
|
140
|
+
build: "typesol build",
|
|
141
|
+
// The tests and the typecheck import the client the build writes: build first.
|
|
142
|
+
pretest: "typesol build --quiet",
|
|
143
|
+
test: "vitest run",
|
|
144
|
+
pretypecheck: "typesol build --quiet",
|
|
145
|
+
typecheck: "tsc -p tsconfig.json",
|
|
146
|
+
deploy: "typesol deploy",
|
|
147
|
+
},
|
|
136
148
|
engines: { node: ">=22.12" },
|
|
137
149
|
devDependencies: {
|
|
138
150
|
// Published as @typesol/cli, installed under the name programs import ("typesol", "typesol/workspace").
|
|
@@ -149,7 +161,7 @@ export function scaffold(dir, name, template = "counter") {
|
|
|
149
161
|
// VS Code loads tsconfig plugins (typesol/ts-plugin) only with the workspace's TypeScript: offer to switch to it.
|
|
150
162
|
".vscode/settings.json": JSON.stringify({ "typescript.tsdk": "node_modules/typescript/lib", "typescript.enablePromptUseWorkspaceTsdk": true }, null, 2) + "\n",
|
|
151
163
|
// target/deploy/*-keypair.json are the programs' addresses: never commit them, but keep a backup.
|
|
152
|
-
".gitignore": "node_modules/\n# target/deploy/*-keypair.json are the programs' addresses (and upgrade keys): never commit them, but BACK THEM UP.\n#
|
|
164
|
+
".gitignore": "node_modules/\n# target/deploy/*-keypair.json are the programs' addresses (and upgrade keys): never commit them, but BACK THEM UP.\n# Without it, a fresh clone still builds and tests at the address recorded in typesol.json, but cannot deploy.\ntarget/\n",
|
|
153
165
|
"tsconfig.json": JSON.stringify({
|
|
154
166
|
compilerOptions: {
|
|
155
167
|
target: "ES2022",
|
|
@@ -172,3 +184,35 @@ export function scaffold(dir, name, template = "counter") {
|
|
|
172
184
|
}
|
|
173
185
|
return Object.keys(files);
|
|
174
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Add a program to an existing project: programs/<name>.ts and tests/<name>.test.ts from a template, and its entry in
|
|
189
|
+
* typesol.json. Returns the files written and the template's extra devDependencies the package.json lacks.
|
|
190
|
+
*/
|
|
191
|
+
export function addProgram(ws, name, template = "counter") {
|
|
192
|
+
if (!/^[a-z][a-z0-9_]*$/.test(name))
|
|
193
|
+
throw new Error(`program name "${name}" must be snake_case`);
|
|
194
|
+
if (ws.programs[name])
|
|
195
|
+
throw new Error(`${CONFIG} already has a program "${name}"`);
|
|
196
|
+
const t = TEMPLATES[template];
|
|
197
|
+
const files = { [`programs/${name}.ts`]: t.program, [`tests/${name}.test.ts`]: t.test(name) };
|
|
198
|
+
const existing = Object.keys(files).filter((f) => existsSync(path.join(ws.root, f)));
|
|
199
|
+
if (existing.length)
|
|
200
|
+
throw new Error(`refusing to overwrite: ${existing.join(", ")}`);
|
|
201
|
+
for (const [file, text] of Object.entries(files)) {
|
|
202
|
+
mkdirSync(path.dirname(path.join(ws.root, file)), { recursive: true });
|
|
203
|
+
writeFileSync(path.join(ws.root, file), text);
|
|
204
|
+
}
|
|
205
|
+
const raw = JSON.parse(readFileSync(ws.file, "utf8"));
|
|
206
|
+
raw.programs[name] = { path: `programs/${name}.ts` };
|
|
207
|
+
writeFileSync(ws.file, JSON.stringify(raw, null, 2) + "\n");
|
|
208
|
+
ws.programs[name] = { path: `programs/${name}.ts` };
|
|
209
|
+
const pkgFile = path.join(ws.root, "package.json");
|
|
210
|
+
const pkg = existsSync(pkgFile)
|
|
211
|
+
? JSON.parse(readFileSync(pkgFile, "utf8"))
|
|
212
|
+
: {};
|
|
213
|
+
const have = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
214
|
+
const missing = Object.entries(t.devDependencies ?? {})
|
|
215
|
+
.filter(([dep]) => !(dep in have))
|
|
216
|
+
.map(([dep, v]) => `${dep}@${v}`);
|
|
217
|
+
return { files: [...Object.keys(files), CONFIG], missing };
|
|
218
|
+
}
|
package/docs/audit.md
CHANGED
|
@@ -67,7 +67,7 @@ Internal reviews, by the maintainers, in October 2026. Their findings and fixes
|
|
|
67
67
|
sequences against state models with value conservation; account layout with two growable Vecs and aliasing through
|
|
68
68
|
remaining accounts. Each run prints its seed (`FUZZ_SEED`), `pnpm fuzz` runs them wide.
|
|
69
69
|
- **Ported programs**: all 46 programs of solana-developers/program-examples, run through their original tests' flows
|
|
70
|
-
and failure paths ([test/ports/README.md](
|
|
70
|
+
and failure paths ([test/ports/README.md](https://github.com/typesol/typesol/blob/main/test/ports/README.md)).
|
|
71
71
|
- **Four-way comparison**: [typesol/benchmarks](https://github.com/typesol/benchmarks) runs 17 of those programs in
|
|
72
72
|
TypeSOL, Anchor, native Rust and Pinocchio, requires the same outcome, and records how each refuses the hostile calls
|
|
73
73
|
and with which error.
|
|
@@ -4,7 +4,7 @@ This page follows one complete Anchor program into TypeSOL: the token escrow fro
|
|
|
4
4
|
[solana-developers/program-examples](https://github.com/solana-developers/program-examples/tree/de090195e4de698e150572c4f886c333323a64a5/tokens/escrow/anchor)
|
|
5
5
|
(`tokens/escrow`, commit `de09019`). It shows the original and the port side by side, what changed, how the two were
|
|
6
6
|
checked against each other, where they still differ, and what the port costs to run. The port is
|
|
7
|
-
[`test/ports/tokens/escrow.ts`](
|
|
7
|
+
[`test/ports/tokens/escrow.ts`](https://github.com/typesol/typesol/blob/main/test/ports/tokens/escrow.ts); [Migrate from Anchor](migrate-from-anchor.md) is the
|
|
8
8
|
general reference.
|
|
9
9
|
|
|
10
10
|
## The program
|
|
@@ -160,13 +160,13 @@ tokenProgram.closeAccount(vault, maker, offer, ["offer", maker.key, offer.id, of
|
|
|
160
160
|
| `ErrorCode::CustomError` (unused upstream) | `enum ErrorCode`, the same code 6000 |
|
|
161
161
|
|
|
162
162
|
Nothing in the program needed a construct TypeSOL lacks, and every account constraint has its TypeSOL form; the port
|
|
163
|
-
is marked PORTED in [the ports table](
|
|
163
|
+
is marked PORTED in [the ports table](https://github.com/typesol/typesol/blob/main/test/ports/README.md).
|
|
164
164
|
|
|
165
165
|
## Same inputs, same results
|
|
166
166
|
|
|
167
167
|
Two independent checks run the original and the port against each other.
|
|
168
168
|
|
|
169
|
-
- **The port's own test** ([`test/porting/ports-tokens.test.ts`](
|
|
169
|
+
- **The port's own test** ([`test/porting/ports-tokens.test.ts`](https://github.com/typesol/typesol/blob/main/test/porting/ports-tokens.test.ts)) runs the upstream flow with SPL
|
|
170
170
|
Token mints and again with Token-2022 mints: make, take (creating the taker's and the maker's missing token accounts),
|
|
171
171
|
make again, a refund attempt by someone other than the maker, and the refund. It checks balances, the decoded offer
|
|
172
172
|
and that offer and vault are closed.
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
This page ports a program that holds real authority on mainnet:
|
|
4
4
|
[coral-xyz/multisig](https://github.com/coral-xyz/multisig) (`programs/multisig/src/lib.rs`, Anchor 0.25, Apache-2.0),
|
|
5
5
|
deployed at `msigUdDBsR4zSUYqYEDrc1LcgtmuSDDM7KxpRUXNC6U`. The port is
|
|
6
|
-
[`examples/multisig.ts`](
|
|
7
|
-
binary that runs on mainnet: [`test/examples/multisig.test.ts`](
|
|
6
|
+
[`examples/multisig.ts`](https://github.com/typesol/typesol/blob/main/examples/multisig.ts). Instead of a twin built for the occasion, it is checked against the
|
|
7
|
+
binary that runs on mainnet: [`test/examples/multisig.test.ts`](https://github.com/typesol/typesol/blob/main/test/examples/multisig.test.ts) runs both under the
|
|
8
8
|
same program id and compares every outcome and every account byte. See
|
|
9
9
|
[case-study-escrow.md](case-study-escrow.md) for a token program and [Migrate from Anchor](migrate-from-anchor.md) for
|
|
10
10
|
the general reference.
|
|
@@ -99,7 +99,7 @@ existing clients and existing accounts work with the port unchanged.
|
|
|
99
99
|
## How it was checked
|
|
100
100
|
|
|
101
101
|
`test/programs/coral_multisig.so` is the program dumped from mainnet on 2026-10-29 (sha256 in
|
|
102
|
-
[`test/programs/SOURCES.md`](
|
|
102
|
+
[`test/programs/SOURCES.md`](https://github.com/typesol/typesol/blob/main/test/programs/SOURCES.md)). The test loads it into one LiteSVM and the port into
|
|
103
103
|
another, both at `msigUdDB…`, then sends each transaction to both. After each one it requires the same outcome (success,
|
|
104
104
|
or the same error down to the code) and the same lamports, owner and data bytes for every account involved.
|
|
105
105
|
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
This page ports the trading core of a production AMM: [Raydium CP-Swap](https://github.com/raydium-io/raydium-cp-swap)
|
|
4
4
|
(`programs/cp-swap`, Anchor 1.0.2, Apache-2.0). It is deployed on mainnet at
|
|
5
|
-
`CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C`. The port is [`examples/raydium-cp-swap/`](
|
|
5
|
+
`CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C`. The port is [`examples/raydium-cp-swap/`](https://github.com/typesol/typesol/blob/main/examples/raydium-cp-swap)
|
|
6
6
|
(`state.ts`, `curve.ts`, `raydium_cp_swap.ts`). As with [coral-xyz/multisig](case-study-multisig.md), it is checked
|
|
7
7
|
against the binary that runs on mainnet, not a rebuild.
|
|
8
8
|
|
|
9
9
|
## What is ported
|
|
10
10
|
|
|
11
|
-
The port covers
|
|
11
|
+
The port covers 10 of the original's 24 instructions:
|
|
12
12
|
|
|
13
|
+
- `initialize`, which creates a pool with its first liquidity;
|
|
13
14
|
- the four trading instructions: `swap_base_input`, `swap_base_output`, `deposit` and `withdraw`;
|
|
14
15
|
- `collect_protocol_fee` and `collect_fund_fee`;
|
|
15
16
|
- the admin instructions `create_amm_config`, `update_amm_config` and `update_pool_status`.
|
|
@@ -24,9 +25,7 @@ It also keeps the original's names, argument order and error codes, and emits th
|
|
|
24
25
|
|
|
25
26
|
These are not ported yet:
|
|
26
27
|
|
|
27
|
-
- **`
|
|
28
|
-
run time, and allocate a program account by hand: transfer, allocate and assign when the address was pre-funded.
|
|
29
|
-
TypeSOL's `Init<T>` fixes the choice at compile time and reports an existing account with its own error.
|
|
28
|
+
- **`initialize_with_permission`.** It is `initialize` for a creator the admin authorized, with the creator fee on.
|
|
30
29
|
- **The creator-fee instructions**: `collect_creator_fee`, `collect_creator_fee_permissionless`,
|
|
31
30
|
`create_creator_fee_share` and `close_creator_fee_share`.
|
|
32
31
|
- **The permission instructions**: `create_permission_pda` and `close_permission_pda`.
|
|
@@ -38,7 +37,19 @@ the creator fee on), so a pool the original created and configured is traded the
|
|
|
38
37
|
|
|
39
38
|
## What it needed
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
Creating the pool by hand, as the original does, needed a few general features (`test/language/manual-init.test.ts`):
|
|
41
|
+
|
|
42
|
+
- `systemProgram.allocate` and `assign`, for an address someone pre-funded;
|
|
43
|
+
- `programId()` and `findProgramAddressBump(seeds, program)`, to sign as the pool PDA;
|
|
44
|
+
- `initAccount<T>(account)`, Anchor's `load_init`: a program account the body created becomes a struct to fill;
|
|
45
|
+
- `Pubkey.compare`, for the original's `token_0_mint < token_1_mint`;
|
|
46
|
+
- `ata.create(payer, tokenProgram)`, an associated token account under one of several token programs.
|
|
47
|
+
|
|
48
|
+
`Init` accounts also now fail on an address already in use as Anchor's do. TypeSOL used to check first and fail with
|
|
49
|
+
3000; now the System Program refuses the address (`AccountAlreadyInUse`, custom 0). It also checks that the payer is
|
|
50
|
+
not the account being created (4101).
|
|
51
|
+
|
|
52
|
+
Four Token-2022 reads were added to the compiler for this port (`test/integrations/t22ext.test.ts`):
|
|
42
53
|
|
|
43
54
|
- `transferFeeInverse(mint, amountReceived)`: spl-token-2022's `calculate_inverse_epoch_fee`, used for deposits and
|
|
44
55
|
exact-output swaps.
|
|
@@ -54,8 +65,8 @@ The rest uses features TypeSOL already had:
|
|
|
54
65
|
|
|
55
66
|
## How it was checked
|
|
56
67
|
|
|
57
|
-
[`test/examples/raydium-cp-swap.test.ts`](
|
|
58
|
-
mainnet on 2026-10-30 (slot 452376460; sha256 in [`test/programs/SOURCES.md`](
|
|
68
|
+
[`test/examples/raydium-cp-swap.test.ts`](https://github.com/typesol/typesol/blob/main/test/examples/raydium-cp-swap.test.ts) loads the binary dumped from
|
|
69
|
+
mainnet on 2026-10-30 (slot 452376460; sha256 in [`test/programs/SOURCES.md`](https://github.com/typesol/typesol/blob/main/test/programs/SOURCES.md)) into one
|
|
59
70
|
LiteSVM and the port into another. Both use the same program id and the same clock.
|
|
60
71
|
|
|
61
72
|
**Setup.**
|
|
@@ -67,8 +78,18 @@ LiteSVM and the port into another. Both use the same program id and the same clo
|
|
|
67
78
|
**Comparison.** For each transaction, the test requires the same outcome (success, or the same error down to the
|
|
68
79
|
code), the same lamports, owner and data for every account involved, and the same events byte for byte.
|
|
69
80
|
|
|
70
|
-
There are
|
|
71
|
-
|
|
81
|
+
There are 70 transactions:
|
|
82
|
+
|
|
83
|
+
- **Pool creation.** These cases are covered:
|
|
84
|
+
- a pool at its PDA, at a signing keypair, and at a pre-funded address;
|
|
85
|
+
- a pool with the creation fee, paid in wrapped SOL;
|
|
86
|
+
- a pool of Token-2022 fee mints;
|
|
87
|
+
- creating the same pool twice;
|
|
88
|
+
- an address that did not sign (2501);
|
|
89
|
+
- mints in the wrong order (2003);
|
|
90
|
+
- an unsupported extension (6007);
|
|
91
|
+
- a disabled config (6000);
|
|
92
|
+
- too little liquidity (6009).
|
|
72
93
|
- **Swaps.** Both directions, by input and by output; the observation ring advancing as the clock moves; slippage
|
|
73
94
|
(6005); zero amounts.
|
|
74
95
|
- **Liquidity.** Deposit, a partial withdrawal, slippage both ways, withdrawing more LP than held, zero.
|
|
@@ -92,20 +113,29 @@ Compute units per transaction, mainnet original against the port, from that test
|
|
|
92
113
|
|
|
93
114
|
| Instruction | Raydium (mainnet) | TypeSOL | |
|
|
94
115
|
| --- | ---: | ---: | ---: |
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
116
|
+
| `initialize` | 83,474 | 39,352 | −53% |
|
|
117
|
+
| `initialize`, Token-2022 transfer fees | 101,962 | 55,795 | −45% |
|
|
118
|
+
| `swap_base_input` | 24,142 | 5,734 | −76% |
|
|
119
|
+
| `swap_base_output` | 24,571 | 5,941 | −76% |
|
|
120
|
+
| `deposit` | 25,004 | 6,190 | −75% |
|
|
121
|
+
| `withdraw` | 25,211 | 6,201 | −75% |
|
|
122
|
+
| `collect_protocol_fee` | 20,205 | 4,189 | −79% |
|
|
123
|
+
| `swap_base_input`, Token-2022 transfer fees | 31,365 | 12,083 | −61% |
|
|
124
|
+
| `swap_base_output`, Token-2022 transfer fees | 32,542 | 14,101 | −57% |
|
|
125
|
+
| `deposit`, Token-2022 transfer fees | 33,237 | 14,482 | −56% |
|
|
103
126
|
|
|
104
127
|
The Token-2022 rows include the token program's own work, which is the same in both. Refusals cost far less. For
|
|
105
|
-
example, a swap through the wrong config costs 17,190 against 1,
|
|
128
|
+
example, a swap through the wrong config costs 17,190 against 1,656.
|
|
129
|
+
|
|
130
|
+
On size, the port's binary is 143,560 bytes and the deployed original is 793,824 bytes. The original also contains the
|
|
131
|
+
14 instructions not ported here, so the size ratio overstates the gain for the same feature set.
|
|
132
|
+
|
|
133
|
+
Pool creation is mostly the token programs' and the System Program's own work (account creation, initialization,
|
|
134
|
+
transfers), which costs the same in both. The difference is the program's part. Its cost also varies from run to run
|
|
135
|
+
with the PDA bump searches of the random keys the test uses, in both programs alike.
|
|
106
136
|
|
|
107
|
-
|
|
108
|
-
|
|
137
|
+
Two general optimizations came out of profiling this port. u128 arithmetic now takes the native 64-bit instructions
|
|
138
|
+
when the values fit, and an instruction reads the Clock once. Together they took a swap from 7,478 to 5,734.
|
|
109
139
|
|
|
110
140
|
## Where they differ
|
|
111
141
|
|
package/docs/cli.md
CHANGED
|
@@ -7,10 +7,11 @@ error. Exit codes: **0** success, **1** failure (compile errors, failed deploy,
|
|
|
7
7
|
| Command | What it does |
|
|
8
8
|
| --- | --- |
|
|
9
9
|
| `typesol init [<dir>] [--name <program>] [--template counter\|vault\|escrow]` | Create a project: `typesol.json`, `programs/<name>.ts`, `tests/<name>.test.ts` (LiteSVM), `package.json`, `tsconfig.json`, `programs/tsconfig.json` (with the editor plugin) and `.gitignore`. `<name>` must be snake_case; by default it is derived from `<dir>` (`my-app` → `my_app`). The template picks the program and its test: `counter` (default, a PDA counter per user), `vault` (SOL at a PDA: deposit, withdraw above rent, close) or `escrow` (SPL tokens: make, take, refund, the offer PDA signing for its vault). Refuses to overwrite files. It warns, with the install commands, when the platform-tools that building needs are missing. |
|
|
10
|
+
| `typesol new <program> [--template counter\|vault\|escrow]` | In a project: add a program, `programs/<program>.ts` and `tests/<program>.test.ts` from the template, and its entry in `typesol.json`. Refuses to overwrite files or reuse a name. |
|
|
10
11
|
| `typesol doctor [--url <rpc>] [--config <cli config>]` | Check what building, testing and deploying need: Node.js, the platform-tools, the Solana CLI, its keypair, the RPC (`--url`, a cluster moniker, or the CLI config) and the keypair's balance there, and the project. Each problem is printed with the command that fixes it. Exit code 1 when building is impossible (Node.js or the platform-tools missing); deploy pieces are warnings. |
|
|
11
|
-
| `typesol build [<program>…] [--sbpf v0\|v1\|v2] [--profile] [--quiet]` | In a project: build every program (or those named) into `<out>/<name>/`: `<name>.so`, `<name>.json` (Anchor IDL), `<name>.client.ts` (TypeScript client, see [client.md](client.md)), `<name>.c`, `<name>.build.json`. The first build creates `<out>/deploy/<name>-keypair.json` and records the address in `typesol.json`; later builds refuse a
|
|
12
|
+
| `typesol build [<program>…] [--sbpf v0\|v1\|v2] [--profile] [--quiet]` | In a project: build every program (or those named) into `<out>/<name>/`: `<name>.so`, `<name>.json` (Anchor IDL), `<name>.client.ts` (TypeScript client, see [client.md](client.md)), `<name>.c`, `<name>.build.json`. The first build creates `<out>/deploy/<name>-keypair.json` and records the address in `typesol.json`; later builds refuse a different keypair. Without the keypair (a fresh clone, CI) it builds at the recorded address and says so; only `deploy` needs the keypair. |
|
|
12
13
|
| `typesol build <file.ts> [--out <dir>] [--program-id <keypair.json>] [--sbpf …] [--profile]` | Outside a project (or a file that is not one of its programs): build that file. A project program's `.ts` builds as that program. |
|
|
13
|
-
| `typesol check <file.ts> [--json] [--stdin]` | Type-check and validate without building. `--json` prints `{ ok, diagnostics: [{ file, line, column, message }] }`; `--stdin` checks the text given on stdin as that file (its imports come from disk). |
|
|
14
|
+
| `typesol check [<program>… \| <file.ts>] [--json] [--stdin]` | Type-check and validate without building. In a project, no argument checks every program (or those named) and exits 1 if any has errors. `--json` prints `{ ok, diagnostics: [{ file, line, column, message }] }`; `--stdin` checks the text given on stdin as that file (its imports come from disk). |
|
|
14
15
|
| `typesol emit-c <file.ts> [--out <file.c>] [--profile]` | Print or write the generated C. |
|
|
15
16
|
| `typesol deploy [<program>…] [--url <rpc>] [--keypair <payer.json>] [--config <cli config>] [--dry-run] [--sbpf …]` | Build, then `solana program deploy --use-rpc` at the program keypair's address. Deploying again upgrades (the payer must be the upgrade authority). `--dry-run` builds and prints the commands. Before sending anything it checks that the RPC answers and that the payer holds enough for the rent (about twice the binary's on a first deploy, while the buffer exists), and says what to do if not (start `solana-test-validator`, `solana airdrop` on devnet or a local validator). Needs `solana` on PATH. |
|
|
16
17
|
| `typesol idl publish [<program>…] [--url <rpc>] [--keypair <authority.json>] [--config <cli config>] [--non-canonical]` | Compile (the binary is not rebuilt), then write each IDL to the Program Metadata program (seed `idl`). Canonical IDLs must be signed by the upgrade authority. Defaults come from the Solana CLI config (`~/.config/solana/cli/config.yml`). |
|
|
@@ -33,7 +34,8 @@ error. Exit codes: **0** success, **1** failure (compile errors, failed deploy,
|
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
`"programs": { "vault": "programs/vault.ts" }` (a plain path) is accepted too. Keep `target/deploy/*-keypair.json`
|
|
36
|
-
safe and out of git: it is each program's address and its first upgrade authority must not lose it.
|
|
37
|
+
safe and out of git: it is each program's address and its first upgrade authority must not lose it. A clone without
|
|
38
|
+
it still builds and tests (`npm test` builds first) at the recorded address; deploying needs it.
|
|
37
39
|
|
|
38
40
|
## Editor
|
|
39
41
|
|