@star-factory/sdk-launchpad 0.1.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/README.md +343 -0
- package/dist/claims/accounts.d.ts +49 -0
- package/dist/claims/accounts.d.ts.map +1 -0
- package/dist/claims/accounts.js +118 -0
- package/dist/claims/accounts.js.map +1 -0
- package/dist/claims/eligibility.d.ts +67 -0
- package/dist/claims/eligibility.d.ts.map +1 -0
- package/dist/claims/eligibility.js +275 -0
- package/dist/claims/eligibility.js.map +1 -0
- package/dist/claims/index.d.ts +5 -0
- package/dist/claims/index.d.ts.map +1 -0
- package/dist/claims/index.js +41 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/claims/pdas.d.ts +24 -0
- package/dist/claims/pdas.d.ts.map +1 -0
- package/dist/claims/pdas.js +43 -0
- package/dist/claims/pdas.js.map +1 -0
- package/dist/claims/tx.d.ts +47 -0
- package/dist/claims/tx.d.ts.map +1 -0
- package/dist/claims/tx.js +126 -0
- package/dist/claims/tx.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions/cancel-launch.d.ts +16 -0
- package/dist/instructions/cancel-launch.d.ts.map +1 -0
- package/dist/instructions/cancel-launch.js +72 -0
- package/dist/instructions/cancel-launch.js.map +1 -0
- package/dist/instructions/configure-launch.d.ts +16 -0
- package/dist/instructions/configure-launch.d.ts.map +1 -0
- package/dist/instructions/configure-launch.js +50 -0
- package/dist/instructions/configure-launch.js.map +1 -0
- package/dist/instructions/constants.d.ts +8 -0
- package/dist/instructions/constants.d.ts.map +1 -0
- package/dist/instructions/constants.js +14 -0
- package/dist/instructions/constants.js.map +1 -0
- package/dist/instructions/create-launch-token.d.ts +18 -0
- package/dist/instructions/create-launch-token.d.ts.map +1 -0
- package/dist/instructions/create-launch-token.js +65 -0
- package/dist/instructions/create-launch-token.js.map +1 -0
- package/dist/instructions/execute-launch.d.ts +68 -0
- package/dist/instructions/execute-launch.d.ts.map +1 -0
- package/dist/instructions/execute-launch.js +190 -0
- package/dist/instructions/execute-launch.js.map +1 -0
- package/dist/instructions/index.d.ts +8 -0
- package/dist/instructions/index.d.ts.map +1 -0
- package/dist/instructions/index.js +57 -0
- package/dist/instructions/index.js.map +1 -0
- package/dist/instructions/initialize-launch.d.ts +15 -0
- package/dist/instructions/initialize-launch.d.ts.map +1 -0
- package/dist/instructions/initialize-launch.js +71 -0
- package/dist/instructions/initialize-launch.js.map +1 -0
- package/dist/instructions/pdas.d.ts +95 -0
- package/dist/instructions/pdas.d.ts.map +1 -0
- package/dist/instructions/pdas.js +168 -0
- package/dist/instructions/pdas.js.map +1 -0
- package/dist/pdas.d.ts +19 -0
- package/dist/pdas.d.ts.map +1 -0
- package/dist/pdas.js +40 -0
- package/dist/pdas.js.map +1 -0
- package/dist/sdk.d.ts +274 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +505 -0
- package/dist/sdk.js.map +1 -0
- package/dist/types.d.ts +578 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/zc/client.d.ts +69 -0
- package/dist/zc/client.d.ts.map +1 -0
- package/dist/zc/client.js +121 -0
- package/dist/zc/client.js.map +1 -0
- package/dist/zc/constants.d.ts +49 -0
- package/dist/zc/constants.d.ts.map +1 -0
- package/dist/zc/constants.js +64 -0
- package/dist/zc/constants.js.map +1 -0
- package/dist/zc/index.d.ts +4 -0
- package/dist/zc/index.d.ts.map +1 -0
- package/dist/zc/index.js +7 -0
- package/dist/zc/index.js.map +1 -0
- package/dist/zc/types.d.ts +65 -0
- package/dist/zc/types.d.ts.map +1 -0
- package/dist/zc/types.js +3 -0
- package/dist/zc/types.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZCApiError = exports.ZCClient = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
/**
|
|
7
|
+
* zCombinator API Client - Off-Chain Operations
|
|
8
|
+
*
|
|
9
|
+
* Handles the off-chain DAO reservation step via ZC's REST API.
|
|
10
|
+
*
|
|
11
|
+
* @see https://docs.combinator.trade/llms.txt
|
|
12
|
+
* @see https://github.com/zcombinatorio/combinator/blob/main/ui/routes/dao/creation.ts
|
|
13
|
+
*/
|
|
14
|
+
class ZCClient {
|
|
15
|
+
apiKey;
|
|
16
|
+
cluster;
|
|
17
|
+
apiEndpoint;
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.apiKey = config.apiKey;
|
|
20
|
+
this.cluster = config.cluster;
|
|
21
|
+
this.apiEndpoint = config.apiEndpoint ?? constants_1.ZC_API_ENDPOINTS[config.cluster];
|
|
22
|
+
}
|
|
23
|
+
// ============================================================================
|
|
24
|
+
// Health Check
|
|
25
|
+
// ============================================================================
|
|
26
|
+
/**
|
|
27
|
+
* Check API server health status.
|
|
28
|
+
*
|
|
29
|
+
* @see https://docs.combinator.trade/api-reference/health
|
|
30
|
+
* @returns Health status and environment configuration
|
|
31
|
+
*/
|
|
32
|
+
async health() {
|
|
33
|
+
const url = `${this.apiEndpoint}/health`;
|
|
34
|
+
const response = await fetch(url);
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
throw new ZCApiError(`Health check failed (${response.status})`, response.status, await response.text());
|
|
37
|
+
}
|
|
38
|
+
return (await response.json());
|
|
39
|
+
}
|
|
40
|
+
// ============================================================================
|
|
41
|
+
// Reserve Admin
|
|
42
|
+
// ============================================================================
|
|
43
|
+
/**
|
|
44
|
+
* Reserve an admin key for external DAO creation.
|
|
45
|
+
*
|
|
46
|
+
* This is an OFF-CHAIN API call to ZC that:
|
|
47
|
+
* 1. Allocates a managed admin wallet from ZC's key service
|
|
48
|
+
* 2. Creates an optimistic DAO entry in ZC's database
|
|
49
|
+
* 3. Returns the admin wallet to use in transferAdmin IX
|
|
50
|
+
*
|
|
51
|
+
* PREREQUISITES (must be derived BEFORE calling this):
|
|
52
|
+
* - tokenMint: the vanity mint address (from grinding)
|
|
53
|
+
* - poolAddress: derived from (baseMint, quoteMint, DAMM_CONFIG)
|
|
54
|
+
*
|
|
55
|
+
* After calling this, build your atomic transaction with:
|
|
56
|
+
* 1. Token launch instructions
|
|
57
|
+
* 2. Pool launch instructions
|
|
58
|
+
* 3. DAO creation (with launchpad PDA as temp admin)
|
|
59
|
+
* 4. transferAdmin to ZC's managed admin (from this response)
|
|
60
|
+
* 5. LP transfer to ZC's admin
|
|
61
|
+
*
|
|
62
|
+
* @param params - Reservation parameters
|
|
63
|
+
* @returns Response with admin wallet, key index, and DAO ID
|
|
64
|
+
*
|
|
65
|
+
* @see https://github.com/zcombinatorio/combinator/blob/main/ui/routes/dao/creation.ts
|
|
66
|
+
*/
|
|
67
|
+
async reserveAdmin(params) {
|
|
68
|
+
const url = `${this.apiEndpoint}/dao/reserve-admin`;
|
|
69
|
+
const body = {
|
|
70
|
+
api_key: this.apiKey,
|
|
71
|
+
name: params.name,
|
|
72
|
+
token_mint: params.tokenMint.toBase58(),
|
|
73
|
+
pool_address: params.poolAddress.toBase58(),
|
|
74
|
+
pool_type: params.poolType,
|
|
75
|
+
quote_mint: params.quoteMint.toBase58(),
|
|
76
|
+
treasury_cosigner: params.treasuryCosigner.toBase58(),
|
|
77
|
+
owner_wallet: params.ownerWallet.toBase58(),
|
|
78
|
+
};
|
|
79
|
+
const response = await fetch(url, {
|
|
80
|
+
method: 'POST',
|
|
81
|
+
headers: {
|
|
82
|
+
'Content-Type': 'application/json',
|
|
83
|
+
},
|
|
84
|
+
body: JSON.stringify(body),
|
|
85
|
+
});
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
const errorBody = await response.text();
|
|
88
|
+
let errorMessage;
|
|
89
|
+
try {
|
|
90
|
+
const errorJson = JSON.parse(errorBody);
|
|
91
|
+
errorMessage = errorJson.error || errorJson.details || errorBody;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
errorMessage = errorBody;
|
|
95
|
+
}
|
|
96
|
+
throw new ZCApiError(`ZC API error (${response.status}): ${errorMessage}`, response.status, errorMessage);
|
|
97
|
+
}
|
|
98
|
+
const data = (await response.json());
|
|
99
|
+
return {
|
|
100
|
+
adminWallet: new web3_js_1.PublicKey(data.admin_wallet),
|
|
101
|
+
adminKeyIdx: data.admin_key_idx,
|
|
102
|
+
daoId: data.dao_id,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.ZCClient = ZCClient;
|
|
107
|
+
/**
|
|
108
|
+
* Error thrown by ZC API calls
|
|
109
|
+
*/
|
|
110
|
+
class ZCApiError extends Error {
|
|
111
|
+
statusCode;
|
|
112
|
+
apiError;
|
|
113
|
+
constructor(message, statusCode, apiError) {
|
|
114
|
+
super(message);
|
|
115
|
+
this.statusCode = statusCode;
|
|
116
|
+
this.apiError = apiError;
|
|
117
|
+
this.name = 'ZCApiError';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.ZCApiError = ZCApiError;
|
|
121
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/zc/client.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAA+C;AAQ/C;;;;;;;GAOG;AACH,MAAa,QAAQ;IACV,MAAM,CAAS;IACf,OAAO,CAAwC;IAC/C,WAAW,CAAS;IAE7B,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,4BAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CA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
|
4
|
+
*
|
|
5
|
+
* @see https://docs.combinator.trade/llms.txt
|
|
6
|
+
*/
|
|
7
|
+
export declare const ZC_API_ENDPOINTS: {
|
|
8
|
+
readonly devnet: "https://api.devnet.zcombinator.io";
|
|
9
|
+
readonly 'mainnet-beta': "https://api.zcombinator.io";
|
|
10
|
+
readonly testnet: "https://api.testnet.zcombinator.io";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* ZC Futarchy program - handles DAOs and proposals
|
|
14
|
+
*
|
|
15
|
+
* @see https://github.com/zcombinatorio/programs
|
|
16
|
+
*/
|
|
17
|
+
export declare const ZC_FUTARCHY_PROGRAM_ID: PublicKey;
|
|
18
|
+
/**
|
|
19
|
+
* ZC AMM program - conditional token markets with TWAP oracle
|
|
20
|
+
*/
|
|
21
|
+
export declare const ZC_AMM_PROGRAM_ID: PublicKey;
|
|
22
|
+
/**
|
|
23
|
+
* ZC Vault program - conditional tokens
|
|
24
|
+
*/
|
|
25
|
+
export declare const ZC_VAULT_PROGRAM_ID: PublicKey;
|
|
26
|
+
/**
|
|
27
|
+
* ZC Staking Vault program
|
|
28
|
+
*/
|
|
29
|
+
export declare const ZC_SVAULT_PROGRAM_ID: PublicKey;
|
|
30
|
+
/**
|
|
31
|
+
* ZC Fee Authority
|
|
32
|
+
*/
|
|
33
|
+
export declare const ZC_FEE_AUTHORITY: PublicKey;
|
|
34
|
+
/**
|
|
35
|
+
* Fixed DAMM config PDA used for all launches
|
|
36
|
+
*/
|
|
37
|
+
export declare const DAMM_CONFIG_PDA: PublicKey;
|
|
38
|
+
/**
|
|
39
|
+
* DAMM v2 program ID (Meteora)
|
|
40
|
+
*/
|
|
41
|
+
export declare const DAMM_PROGRAM_ID: PublicKey;
|
|
42
|
+
/**
|
|
43
|
+
* ZC API rate limit: 8 requests per IP per 2-minute window
|
|
44
|
+
*/
|
|
45
|
+
export declare const ZC_API_RATE_LIMIT: {
|
|
46
|
+
readonly requests: 8;
|
|
47
|
+
readonly windowMs: number;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/zc/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAM5C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAMX;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,WAElC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,WAE7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,WAE/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,WAEhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,WAE5B,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,eAAe,WAE3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,WAE3B,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZC_API_RATE_LIMIT = exports.DAMM_PROGRAM_ID = exports.DAMM_CONFIG_PDA = exports.ZC_FEE_AUTHORITY = exports.ZC_SVAULT_PROGRAM_ID = exports.ZC_VAULT_PROGRAM_ID = exports.ZC_AMM_PROGRAM_ID = exports.ZC_FUTARCHY_PROGRAM_ID = exports.ZC_API_ENDPOINTS = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// ZC API Configuration
|
|
7
|
+
// ============================================================================
|
|
8
|
+
/**
|
|
9
|
+
* ZC API base URLs by cluster
|
|
10
|
+
*
|
|
11
|
+
* @see https://docs.combinator.trade/llms.txt
|
|
12
|
+
*/
|
|
13
|
+
exports.ZC_API_ENDPOINTS = {
|
|
14
|
+
devnet: 'https://api.devnet.zcombinator.io',
|
|
15
|
+
'mainnet-beta': 'https://api.zcombinator.io',
|
|
16
|
+
testnet: 'https://api.testnet.zcombinator.io',
|
|
17
|
+
};
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// ZC Program IDs
|
|
20
|
+
// ============================================================================
|
|
21
|
+
/**
|
|
22
|
+
* ZC Futarchy program - handles DAOs and proposals
|
|
23
|
+
*
|
|
24
|
+
* @see https://github.com/zcombinatorio/programs
|
|
25
|
+
*/
|
|
26
|
+
exports.ZC_FUTARCHY_PROGRAM_ID = new web3_js_1.PublicKey('FUTKPrt66uGGCTpk6f9tmRX2325cWgXzGCwvWhyyzjea');
|
|
27
|
+
/**
|
|
28
|
+
* ZC AMM program - conditional token markets with TWAP oracle
|
|
29
|
+
*/
|
|
30
|
+
exports.ZC_AMM_PROGRAM_ID = new web3_js_1.PublicKey('AMMSgtnttAKx5Ad2Y1socKJ3CcQYCB2ctg8U2SAHcVEx');
|
|
31
|
+
/**
|
|
32
|
+
* ZC Vault program - conditional tokens
|
|
33
|
+
*/
|
|
34
|
+
exports.ZC_VAULT_PROGRAM_ID = new web3_js_1.PublicKey('VLTEetGyPKtffi1u3Jr8btWATv33NeDyUuRsPENFPTU');
|
|
35
|
+
/**
|
|
36
|
+
* ZC Staking Vault program
|
|
37
|
+
*/
|
|
38
|
+
exports.ZC_SVAULT_PROGRAM_ID = new web3_js_1.PublicKey('GmH3zEvgmWoC6Y6hxinYYRWLCuxUikRN5SAmVDVF4Jjy');
|
|
39
|
+
/**
|
|
40
|
+
* ZC Fee Authority
|
|
41
|
+
*/
|
|
42
|
+
exports.ZC_FEE_AUTHORITY = new web3_js_1.PublicKey('FEEnkcCNE2623LYCPtLf63LFzXpCFigBLTu4qZovRGZC');
|
|
43
|
+
// ============================================================================
|
|
44
|
+
// DAMM Configuration
|
|
45
|
+
// ============================================================================
|
|
46
|
+
/**
|
|
47
|
+
* Fixed DAMM config PDA used for all launches
|
|
48
|
+
*/
|
|
49
|
+
exports.DAMM_CONFIG_PDA = new web3_js_1.PublicKey('HYjs17C5byRReaJyjB3kxZiX9HaUzQoW2LpyKhrSfP84');
|
|
50
|
+
/**
|
|
51
|
+
* DAMM v2 program ID (Meteora)
|
|
52
|
+
*/
|
|
53
|
+
exports.DAMM_PROGRAM_ID = new web3_js_1.PublicKey('cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG');
|
|
54
|
+
// ============================================================================
|
|
55
|
+
// API Rate Limits
|
|
56
|
+
// ============================================================================
|
|
57
|
+
/**
|
|
58
|
+
* ZC API rate limit: 8 requests per IP per 2-minute window
|
|
59
|
+
*/
|
|
60
|
+
exports.ZC_API_RATE_LIMIT = {
|
|
61
|
+
requests: 8,
|
|
62
|
+
windowMs: 2 * 60 * 1000, // 2 minutes
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/zc/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAE5C,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E;;;;GAIG;AACU,QAAA,gBAAgB,GAAG;IAC9B,MAAM,EAAE,mCAAmC;IAC3C,cAAc,EAAE,4BAA4B;IAC5C,OAAO,EAAE,oCAAoC;CACrC,CAAC;AAEX,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,IAAI,mBAAS,CACjD,8CAA8C,CAC/C,CAAC;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEF;;GAEG;AACU,QAAA,mBAAmB,GAAG,IAAI,mBAAS,CAC9C,6CAA6C,CAC9C,CAAC;AAEF;;GAEG;AACU,QAAA,oBAAoB,GAAG,IAAI,mBAAS,CAC/C,8CAA8C,CAC/C,CAAC;AAEF;;GAEG;AACU,QAAA,gBAAgB,GAAG,IAAI,mBAAS,CAC3C,8CAA8C,CAC/C,CAAC;AAEF,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E;;GAEG;AACU,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,8CAA8C,CAC/C,CAAC;AAEF;;GAEG;AACU,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,6CAA6C,CAC9C,CAAC;AAEF,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E;;GAEG;AACU,QAAA,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,YAAY;CAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zc/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
package/dist/zc/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./client"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./constants"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/zc/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,sDAA4B;AAC5B,kDAAwB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for ZC API client
|
|
4
|
+
*/
|
|
5
|
+
export interface ZCClientConfig {
|
|
6
|
+
/** API key for authentication (DAO_RESERVE_API_KEY) */
|
|
7
|
+
apiKey: string;
|
|
8
|
+
/** Solana cluster */
|
|
9
|
+
cluster: 'devnet' | 'mainnet-beta' | 'testnet';
|
|
10
|
+
/** Optional API endpoint override */
|
|
11
|
+
apiEndpoint?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Pool type for the DAO
|
|
15
|
+
*/
|
|
16
|
+
export type PoolType = 'damm' | 'dlmm';
|
|
17
|
+
/**
|
|
18
|
+
* Input for reserveAdmin() - the off-chain pre-requisite
|
|
19
|
+
*
|
|
20
|
+
* See: https://github.com/zcombinatorio/combinator/blob/main/ui/routes/dao/creation.ts
|
|
21
|
+
*
|
|
22
|
+
* IMPORTANT: pool_address must be DERIVED before calling this.
|
|
23
|
+
* - token_mint: the vanity mint address (known beforehand from grinding)
|
|
24
|
+
* - pool_address: derived from (baseMint, quoteMint, DAMM_CONFIG)
|
|
25
|
+
*
|
|
26
|
+
* Neither the pool nor the mint exist on-chain yet at this point!
|
|
27
|
+
*/
|
|
28
|
+
export interface ReserveAdminParams {
|
|
29
|
+
/** DAO name (max 32 characters) */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Token mint (vanity mint address - mint doesn't exist yet!) */
|
|
32
|
+
tokenMint: PublicKey;
|
|
33
|
+
/** DERIVED pool address (pool doesn't exist yet!) */
|
|
34
|
+
poolAddress: PublicKey;
|
|
35
|
+
/** Pool type: "damm" or "dlmm" */
|
|
36
|
+
poolType: PoolType;
|
|
37
|
+
/** Quote mint (SOL/USDC) */
|
|
38
|
+
quoteMint: PublicKey;
|
|
39
|
+
/** Treasury cosigner (foundation/team multisig) */
|
|
40
|
+
treasuryCosigner: PublicKey;
|
|
41
|
+
/** Owner wallet (project owner) */
|
|
42
|
+
ownerWallet: PublicKey;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Response from reserveAdmin()
|
|
46
|
+
*
|
|
47
|
+
* Contains the managed admin wallet to use in transferAdmin IX.
|
|
48
|
+
*/
|
|
49
|
+
export interface ReserveAdminResponse {
|
|
50
|
+
/** ZC's managed admin wallet (use this in transferAdmin IX) */
|
|
51
|
+
adminWallet: PublicKey;
|
|
52
|
+
/** ZC internal key index */
|
|
53
|
+
adminKeyIdx: number;
|
|
54
|
+
/** ZC database DAO ID */
|
|
55
|
+
daoId: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Raw API response from ZC (before parsing)
|
|
59
|
+
*/
|
|
60
|
+
export interface ReserveAdminApiResponse {
|
|
61
|
+
admin_wallet: string;
|
|
62
|
+
admin_key_idx: number;
|
|
63
|
+
dao_id: number;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/zc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,OAAO,EAAE,QAAQ,GAAG,cAAc,GAAG,SAAS,CAAC;IAC/C,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,SAAS,EAAE,SAAS,CAAC;IACrB,qDAAqD;IACrD,WAAW,EAAE,SAAS,CAAC;IACvB,kCAAkC;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,4BAA4B;IAC5B,SAAS,EAAE,SAAS,CAAC;IACrB,mDAAmD;IACnD,gBAAgB,EAAE,SAAS,CAAC;IAC5B,mCAAmC;IACnC,WAAW,EAAE,SAAS,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,WAAW,EAAE,SAAS,CAAC;IACvB,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/zc/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/zc/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@star-factory/sdk-launchpad",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for Star Launchpad - Token launches with DAO integration",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Star Protocol",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/star-protocol/star-vault.git",
|
|
10
|
+
"directory": "sdks/sdk-launchpad"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"module": "dist/index.js",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "rm -rf dist && tsc -p ./tsconfig.json",
|
|
20
|
+
"prepublishOnly": "yarn build",
|
|
21
|
+
"clean": "rm -rf dist",
|
|
22
|
+
"test": "echo 'No tests yet'"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"solana",
|
|
29
|
+
"launchpad",
|
|
30
|
+
"dao",
|
|
31
|
+
"zcombinator",
|
|
32
|
+
"damm-v2",
|
|
33
|
+
"token-launch",
|
|
34
|
+
"typescript",
|
|
35
|
+
"sdk"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@coral-xyz/anchor": "0.31.1",
|
|
39
|
+
"@coral-xyz/borsh": "^0.31.1",
|
|
40
|
+
"@meteora-ag/cp-amm-sdk": "^1.2.6",
|
|
41
|
+
"@solana/spl-token": "^0.4.13",
|
|
42
|
+
"@solana/web3.js": "^1.98.4",
|
|
43
|
+
"bn.js": "^5.2.1",
|
|
44
|
+
"bs58": "^6.0.0",
|
|
45
|
+
"tslib": "^2.8.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/bn.js": "^5.1.0",
|
|
49
|
+
"@types/node": "^20.0.0",
|
|
50
|
+
"typescript": "^5.8.2"
|
|
51
|
+
},
|
|
52
|
+
"exports": {
|
|
53
|
+
".": {
|
|
54
|
+
"types": "./dist/index.d.ts",
|
|
55
|
+
"import": "./dist/index.js",
|
|
56
|
+
"require": "./dist/index.js",
|
|
57
|
+
"default": "./dist/index.js"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"typescript": "^5"
|
|
62
|
+
}
|
|
63
|
+
}
|