-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.d.ts
More file actions
254 lines (210 loc) · 5.04 KB
/
index.d.ts
File metadata and controls
254 lines (210 loc) · 5.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/**
* MintMe SDK - TypeScript Definitions
* A simple library for creating tokens on Solana
*/
import type { PublicKey, Connection, Transaction, VersionedTransaction } from "@solana/web3.js"
/**
* Type for logger function
*/
export type LoggerFunction = (message: string) => void
/**
* Configuration options for token creation (createToken function)
*/
export interface CreateTokenOptions {
/**
* Solana connection
*/
connection: Connection
/**
* Payer's keypair or compatible wallet
*/
payer: any
/**
* Token name
*/
name: string
/**
* Token symbol
*/
symbol: string
/**
* Unique key for this token creation
*/
uniqueKey: string
/**
* Number of decimal places for the token (default 9)
*/
decimals?: number
/**
* Initial supply of the token (default 1000000000)
*/
initialSupply?: number | string
/**
* URI for the token metadata
*/
uri?: string
/**
* Whether to revoke the mint authority after creation (default false)
*/
revokeMint?: boolean
/**
* Whether to revoke the freeze authority after creation (default false)
*/
revokeFreeze?: boolean
/**
* Partner wallet public key
*/
partnerWallet?: string | PublicKey
/**
* Amount for partner wallet (default 0)
*/
partnerAmount?: number | string
/**
* Program ID (optional)
*/
programId?: string | PublicKey
/**
* Program IDL (URL, object, or path, optional)
*/
idl?: string | object
/**
* Custom logger function (optional)
*/
logger?: LoggerFunction
}
/**
* Configuration options for token creation
*/
export interface TokenCreationConfig {
/**
* Name of the token
*/
tokenName: string
/**
* Symbol of the token
*/
tokenSymbol: string
/**
* A unique key for this token creation
*/
uniqueKey: string
/**
* Number of decimal places for the token
*/
decimals: number
/**
* Initial supply of the token
*/
initialSupply: number
/**
* URI for the token metadata
*/
uri?: string
/**
* Whether to revoke the mint authority after creation
*/
revokeMint?: boolean
/**
* Whether to revoke the freeze authority after creation
*/
revokeFreeze?: boolean
/**
* Solana connection string or Connection object
*/
connection: string | Connection
/**
* Solana cluster to use (e.g., 'devnet', 'mainnet-beta')
* Made more flexible to accept any string value for future compatibility
*/
cluster: "devnet" | "testnet" | "mainnet-beta" | string
/**
* Wallet configuration for signing transactions
*/
wallet?:
| {
/**
* Public key of the wallet
*/
publicKey: PublicKey
/**
* Function to sign a transaction
* Updated to support both Transaction and VersionedTransaction
*/
signTransaction?: <T extends Transaction | VersionedTransaction>(transaction: T) => Promise<T>
/**
* Function to sign multiple transactions
* Updated to support both Transaction and VersionedTransaction
*/
signAllTransactions?: <T extends Transaction | VersionedTransaction>(transactions: T[]) => Promise<T[]>
}
| string // Can also be a path to a wallet file
/**
* Custom logger function to capture log messages
*/
logger?: LoggerFunction
/**
* Path to wallet file (when not using wallet object)
*/
walletPath?: string
}
/**
* Result of a token creation operation
*/
export interface TokenCreationResult {
/**
* Whether the operation was successful
*/
success: boolean
/**
* The address of the created token
* @deprecated Use mint instead
*/
tokenAddress?: string
/**
* The address of the created token (mint address)
*/
mint?: string
/**
* The transaction signature
*/
txSignature?: string
/**
* Error message if the operation failed
*/
error?: string
/**
* Additional error details if available
*/
details?: any
/**
* Whether the freeze authority was revoked (if revokeFreeze was true)
*/
freezeRevoked?: boolean
/**
* Transaction signature for the freeze authority revocation
*/
freezeRevokeTx?: string
}
/**
* Creates a token on Solana (advanced function)
* @param options Configuration options for token creation
* @returns A promise that resolves to the result of the token creation
*/
export function createToken(options: CreateTokenOptions): Promise<TokenCreationResult>
/**
* Creates a token on Solana with simplified configuration
* @param config Configuration options for token creation
* @returns A promise that resolves to the result of the token creation
*/
export function createTokenSimple(config: TokenCreationConfig): Promise<TokenCreationResult>
/**
* Sets a custom logger function to capture log messages
* @param loggerFunction Function that will receive log messages
*/
export function setCustomLogger(loggerFunction: LoggerFunction): void
// Export as default and named export for maximum compatibility
export default {
createToken,
createTokenSimple,
setCustomLogger,
}