@bordrless/shared 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/README.md +33 -2
- package/dist/api.d.ts +679 -0
- package/dist/api.js +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/policy.d.ts +632 -0
- package/dist/policy.js +987 -0
- package/dist/programs.d.ts +138 -0
- package/dist/programs.js +176 -0
- package/package.json +44 -3
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP API between the site and the backend. Amounts in base units travel as decimal strings
|
|
3
|
+
* (`Amount`), dollar figures as numbers, times as unix seconds. A figure the backend could not
|
|
4
|
+
* read is null, never zero.
|
|
5
|
+
*/
|
|
6
|
+
export type Address = string;
|
|
7
|
+
/** Base units, as a decimal string. */
|
|
8
|
+
export type Amount = string;
|
|
9
|
+
export type Cluster = 'mainnet' | 'devnet' | 'localnet';
|
|
10
|
+
export type LaunchStatus = 'curve' | 'graduated';
|
|
11
|
+
export type Side = 'buy' | 'sell';
|
|
12
|
+
export interface QuoteToken {
|
|
13
|
+
mint: Address;
|
|
14
|
+
symbol: string;
|
|
15
|
+
name: string;
|
|
16
|
+
decimals: number;
|
|
17
|
+
priceUsd: number | null;
|
|
18
|
+
/** The SPL mint behind it (the wSOL mint for native SOL). */
|
|
19
|
+
underlyingMint: Address;
|
|
20
|
+
native: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface Overview {
|
|
23
|
+
cluster: Cluster;
|
|
24
|
+
/** What launches are quoted in: bridged SOL. */
|
|
25
|
+
quote: QuoteToken;
|
|
26
|
+
solUsd: number | null;
|
|
27
|
+
launches: number;
|
|
28
|
+
graduated: number;
|
|
29
|
+
volume24hUsd: number | null;
|
|
30
|
+
trades24h: number;
|
|
31
|
+
/** The platform's own token, once configured. */
|
|
32
|
+
platformToken: BridgeAsset | null;
|
|
33
|
+
/** Program addresses; `kit` is the v2 token-rules hook. */
|
|
34
|
+
programs: {
|
|
35
|
+
token: Address;
|
|
36
|
+
swap: Address;
|
|
37
|
+
bridge: Address;
|
|
38
|
+
launch: Address;
|
|
39
|
+
kit: Address;
|
|
40
|
+
};
|
|
41
|
+
/** Each program's upgrade authority, read from its ProgramData account; null where it has not been read. */
|
|
42
|
+
programInfo: Record<'token' | 'swap' | 'bridge' | 'launch' | 'kit', ProgramInfo | null>;
|
|
43
|
+
/** Platform totals in lamports of bridged SOL; each null while the indexer does not track it. */
|
|
44
|
+
totals: {
|
|
45
|
+
/** Distributed to holders as holder rewards, all time. */
|
|
46
|
+
rewardsDistributed: Amount | null;
|
|
47
|
+
/** Over launch-pool swaps, the LP fee charged minus what the pool's base rate would have charged (a sell's, in tokens, at that swap's price). */
|
|
48
|
+
sniperFeesKept: Amount | null;
|
|
49
|
+
/** Over trade burns, the amount burned times that swap's pool price. */
|
|
50
|
+
burnedValue: Amount | null;
|
|
51
|
+
/** Creator fees taken, all time. */
|
|
52
|
+
creatorFees: Amount | null;
|
|
53
|
+
};
|
|
54
|
+
launchFeeLamports: Amount;
|
|
55
|
+
openingMcapUsd: number;
|
|
56
|
+
explorer: string;
|
|
57
|
+
}
|
|
58
|
+
/** A launch's token rules, fixed at launch (docs/hooks-v2.md §5). Zeros and nulls for a launch without them. */
|
|
59
|
+
export interface LaunchRules {
|
|
60
|
+
/** Holder rewards taken from buys; holder rewards are on when either side is above 0. */
|
|
61
|
+
holderFeeBuyBps: number;
|
|
62
|
+
/** Holder rewards taken from sells. */
|
|
63
|
+
holderFeeSellBps: number;
|
|
64
|
+
/** Share of a buy's tokens burned. */
|
|
65
|
+
burnBuyBps: number;
|
|
66
|
+
/** Share of a sell's tokens burned. */
|
|
67
|
+
burnSellBps: number;
|
|
68
|
+
/** Max wallet as a share of supply; 0 = off; lifts at graduation. */
|
|
69
|
+
maxWalletBps: number;
|
|
70
|
+
/** Creator wallet lock: when the creator's wallet can sell or send again, unix seconds; null when off. */
|
|
71
|
+
creatorUnlockAt: number | null;
|
|
72
|
+
/** Early-buyer lock: tokens bought before this time are locked, unix seconds; null when off. */
|
|
73
|
+
earlyWindowEndsAt: number | null;
|
|
74
|
+
/** Early-buyer lock: when those tokens unlock, unix seconds; null when off. */
|
|
75
|
+
earlyUnlockAt: number | null;
|
|
76
|
+
/** Holder rewards are on: no program can hold the token, so every pool trade happens on its launch pool. */
|
|
77
|
+
walletsOnly: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** The token rules a launch request chooses (docs/hooks-v2.md §7.1); all zero for none. */
|
|
80
|
+
export interface LaunchRulesInput {
|
|
81
|
+
/** Holder rewards on buys. */
|
|
82
|
+
holderFeeBuyBps: number;
|
|
83
|
+
/** Holder rewards on sells. */
|
|
84
|
+
holderFeeSellBps: number;
|
|
85
|
+
/** Burn on buys. */
|
|
86
|
+
burnBuyBps: number;
|
|
87
|
+
/** Burn on sells. */
|
|
88
|
+
burnSellBps: number;
|
|
89
|
+
/** Max wallet as a share of supply; 0 = off. */
|
|
90
|
+
maxWalletBps: number;
|
|
91
|
+
/** Creator wallet lock in days; 0 = off. */
|
|
92
|
+
creatorLockDays: number;
|
|
93
|
+
/** Early-buyer lock: buys in this many seconds after launch are locked; 0 = off. */
|
|
94
|
+
earlyWindowSecs: number;
|
|
95
|
+
/** Early-buyer lock: seconds after launch when those tokens unlock (above `earlyWindowSecs`). */
|
|
96
|
+
earlyLockSecs: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A creator's own token hook on a launch (docs/hooks-v2.md §5.8): the program the mint names, its
|
|
100
|
+
* token hook flags, and who can upgrade that program (null when it cannot be upgraded, or when it
|
|
101
|
+
* has not been read). The site labels such a token "Custom hook, unverified" on every surface.
|
|
102
|
+
*/
|
|
103
|
+
export interface CustomHookInfo {
|
|
104
|
+
program: Address;
|
|
105
|
+
flags: number;
|
|
106
|
+
/** The wallet that can change the hook's code; null when there is none, or when it has not been read (`upgradeable` tells which). */
|
|
107
|
+
upgradeAuthority: Address | null;
|
|
108
|
+
/** True: `upgradeAuthority` can upgrade it. False: nobody can (final). Null: not read, so nothing is claimed either way. */
|
|
109
|
+
upgradeable: boolean | null;
|
|
110
|
+
}
|
|
111
|
+
/** How a pool's protocol fee is taken (§3.1): a flat rate of the quote (`protocolFeeBps`, ordinary pools), or a share of what the hooks cut (`protocolShareBps`, launch pools). */
|
|
112
|
+
export type ProtocolModel = 'flat' | 'share';
|
|
113
|
+
/**
|
|
114
|
+
* What a `LaunchConfig` holds (§5.7): the rules and the creator fee a launch made from it gets, the
|
|
115
|
+
* creator's own hook with its token flags (null for the kit, or no hook at all), and a label of at
|
|
116
|
+
* most 32 bytes.
|
|
117
|
+
*/
|
|
118
|
+
export interface LaunchConfigData {
|
|
119
|
+
rules: LaunchRulesInput;
|
|
120
|
+
creatorFeeBps: number;
|
|
121
|
+
customHook: {
|
|
122
|
+
program: Address;
|
|
123
|
+
flags: number;
|
|
124
|
+
} | null;
|
|
125
|
+
label: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* `GET /v1/configs/:address?mint=<mint>`: a `LaunchConfig` read from the chain and checked as
|
|
129
|
+
* `create_launch` would check it. `ready` is true when `problems` is empty and, with a custom hook
|
|
130
|
+
* and a mint given, the hook's registry for that mint exists. `hookUpgradeAuthority` is the custom
|
|
131
|
+
* hook program's upgrade authority (null when it cannot be upgraded, or without a hook);
|
|
132
|
+
* `registryReady` is whether the hook has been prepared for `mint` (null without a hook or a mint).
|
|
133
|
+
*/
|
|
134
|
+
export interface ConfigInspection {
|
|
135
|
+
address: Address;
|
|
136
|
+
config: LaunchConfigData;
|
|
137
|
+
/** The wallet that made the config. */
|
|
138
|
+
creator: Address;
|
|
139
|
+
ready: boolean;
|
|
140
|
+
/** Why it could not launch as it is, one sentence each; empty when it could. */
|
|
141
|
+
problems: string[];
|
|
142
|
+
hookUpgradeAuthority: Address | null;
|
|
143
|
+
/** As `CustomHookInfo.upgradeable`; null without a hook or when its program could not be read. */
|
|
144
|
+
hookUpgradeable: boolean | null;
|
|
145
|
+
registryReady: boolean | null;
|
|
146
|
+
/** The hook is Half-Life: the launch prepares it for the mint and lights its furnace itself. */
|
|
147
|
+
halfLife?: boolean;
|
|
148
|
+
}
|
|
149
|
+
/** Live figures of a launch's token rules; each null when the launch lacks the rule or it is not tracked. */
|
|
150
|
+
export interface RuleStats {
|
|
151
|
+
/** Lamports distributed to holders as holder rewards, all time. */
|
|
152
|
+
rewardsDistributed: Amount | null;
|
|
153
|
+
/** Lamports holders have claimed, all time. */
|
|
154
|
+
rewardsClaimed: Amount | null;
|
|
155
|
+
/** Lamports sent to holders through "Share with holders", all time. */
|
|
156
|
+
rewardsShared: Amount | null;
|
|
157
|
+
/** Shared lamports not released to holders yet (a share streams over an hour). */
|
|
158
|
+
rewardsStreaming: Amount | null;
|
|
159
|
+
/** The reward vault's balance: earned and not claimed yet. */
|
|
160
|
+
rewardsUnclaimed: Amount | null;
|
|
161
|
+
/** Lamports of the last 24 hours: holder fees paid into the holder vault plus shares. */
|
|
162
|
+
rewardsPaid24h: Amount | null;
|
|
163
|
+
/** Token base units that earn holder rewards (the kit's eligible supply). */
|
|
164
|
+
eligibleSupply: Amount | null;
|
|
165
|
+
/** Base units burned on trades (not the graduation burn). */
|
|
166
|
+
burned: Amount | null;
|
|
167
|
+
/** The token's supply now, after every burn. */
|
|
168
|
+
liveSupply: Amount | null;
|
|
169
|
+
/** What the creator's wallet holds now. */
|
|
170
|
+
creatorBalance: Amount | null;
|
|
171
|
+
/** The max-wallet cap in base units, fixed at launch; null without max wallet. */
|
|
172
|
+
maxWalletAmount: Amount | null;
|
|
173
|
+
/** Max wallet has lifted (at graduation). */
|
|
174
|
+
maxWalletLifted: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* When a share made now would start streaming, unix seconds: now when nothing streams, otherwise
|
|
177
|
+
* when the share streaming now ends ("If an earlier share is still streaming, yours starts when it
|
|
178
|
+
* ends"). Null while nobody is eligible (a share is refused then), without holder rewards, or when
|
|
179
|
+
* not read. Computed by `shareStartsAt` from the `KitConfig`; absent from backends that predate it.
|
|
180
|
+
*/
|
|
181
|
+
shareStartsAt?: number | null;
|
|
182
|
+
}
|
|
183
|
+
/** A program's address and who can upgrade it. */
|
|
184
|
+
export interface ProgramInfo {
|
|
185
|
+
address: Address;
|
|
186
|
+
/** The upgrade authority; null when there is none or it could not be read. */
|
|
187
|
+
upgradeAuthority: Address | null;
|
|
188
|
+
/** Whether the program can still be upgraded; null when unknown. */
|
|
189
|
+
upgradeable: boolean | null;
|
|
190
|
+
}
|
|
191
|
+
export interface LaunchSummary {
|
|
192
|
+
mint: Address;
|
|
193
|
+
name: string;
|
|
194
|
+
symbol: string;
|
|
195
|
+
image: string | null;
|
|
196
|
+
description: string;
|
|
197
|
+
creator: Address;
|
|
198
|
+
pool: Address;
|
|
199
|
+
status: LaunchStatus;
|
|
200
|
+
createdAt: number;
|
|
201
|
+
graduatedAt: number | null;
|
|
202
|
+
quote: {
|
|
203
|
+
mint: Address;
|
|
204
|
+
symbol: string;
|
|
205
|
+
decimals: number;
|
|
206
|
+
};
|
|
207
|
+
/** Whole quote per whole token. */
|
|
208
|
+
priceQuote: number | null;
|
|
209
|
+
priceUsd: number | null;
|
|
210
|
+
mcapUsd: number | null;
|
|
211
|
+
mcapQuote: number | null;
|
|
212
|
+
/** 0 to 1 along the curve; 1 once graduated. */
|
|
213
|
+
progress: number;
|
|
214
|
+
liquidityQuote: Amount;
|
|
215
|
+
liquidityUsd: number | null;
|
|
216
|
+
volume24hQuote: Amount;
|
|
217
|
+
volume24hUsd: number | null;
|
|
218
|
+
trades24h: number;
|
|
219
|
+
priceChange24h: number | null;
|
|
220
|
+
holders: number;
|
|
221
|
+
lastTradeAt: number | null;
|
|
222
|
+
creatorFeeBps: number;
|
|
223
|
+
lpFeeBps: number;
|
|
224
|
+
protocolFeeBps: number;
|
|
225
|
+
sniperWindowEndsAt: number;
|
|
226
|
+
website: string | null;
|
|
227
|
+
twitter: string | null;
|
|
228
|
+
telegram: string | null;
|
|
229
|
+
/** Token rules, fixed at launch. */
|
|
230
|
+
rules: LaunchRules;
|
|
231
|
+
/** The kit's config account (`["kit", mint]`) when the launch has kit rules, else null. */
|
|
232
|
+
kitConfig: Address | null;
|
|
233
|
+
/** The §7.1 preset whose rules and creator fee the launch matches exactly, 'custom' for other rules (or a config without a custom hook), 'custom-hook' for a config with one, null without rules. */
|
|
234
|
+
preset: string | null;
|
|
235
|
+
/** The `LaunchConfig` the launch was made from (§5.7); null for inline rules. */
|
|
236
|
+
config: Address | null;
|
|
237
|
+
/** The creator's own token hook (§5.8); null when the mint's hook is the kit or none. */
|
|
238
|
+
customHook: CustomHookInfo | null;
|
|
239
|
+
/** How Bordrless is paid on this launch's pool: 'share' (a share of what the rules collect, `protocolShareBps`) or 'flat' (`protocolFeeBps` of the quote). */
|
|
240
|
+
protocolModel: ProtocolModel;
|
|
241
|
+
/** Under the share model, Bordrless's share of the cuts in basis points (2,500 = a quarter); null under the flat model. */
|
|
242
|
+
protocolShareBps: number | null;
|
|
243
|
+
/** Total fee of a buy by the §7.3 formula, outside the sniper window. */
|
|
244
|
+
buyFeeBps: number;
|
|
245
|
+
/** Total fee of a sell by the §7.3 formula, outside the sniper window. */
|
|
246
|
+
sellFeeBps: number;
|
|
247
|
+
/** Lamports distributed to holders as holder rewards, all time; null without holder rewards or while not tracked. */
|
|
248
|
+
rewardsDistributed: Amount | null;
|
|
249
|
+
/** Lamports of the last 24 hours: holder fees paid into the holder vault plus shares; null likewise. */
|
|
250
|
+
rewardsPaid24h: Amount | null;
|
|
251
|
+
/** Base units burned on trades (not the graduation burn); null while not tracked. */
|
|
252
|
+
burned: Amount | null;
|
|
253
|
+
/** The creator wallet's share of the live supply, 0 to 1; null when unknown. */
|
|
254
|
+
creatorShare: number | null;
|
|
255
|
+
}
|
|
256
|
+
export interface LaunchDetail extends LaunchSummary {
|
|
257
|
+
decimals: number;
|
|
258
|
+
supply: Amount;
|
|
259
|
+
uri: string;
|
|
260
|
+
baseReserve: Amount;
|
|
261
|
+
quoteReserve: Amount;
|
|
262
|
+
virtualBase: Amount;
|
|
263
|
+
virtualQuote: Amount;
|
|
264
|
+
graduationQuote: Amount;
|
|
265
|
+
creatorFeesAccrued: Amount;
|
|
266
|
+
creatorFeesClaimed: Amount;
|
|
267
|
+
lpMint: Address;
|
|
268
|
+
lpLocked: Amount;
|
|
269
|
+
lpSupply: Amount;
|
|
270
|
+
graduationTopup: Amount | null;
|
|
271
|
+
graduationBurned: Amount | null;
|
|
272
|
+
/** The launchpad: the hook of the launch's pool, the launch program for every launch. Not the mint's token hook (the kit on a launch with kit rules: `Overview.programs.kit`). */
|
|
273
|
+
hookProgram: Address;
|
|
274
|
+
/** Live figures of the token rules. */
|
|
275
|
+
ruleStats: RuleStats;
|
|
276
|
+
/** The bridged-SOL holding holder rewards are paid from; null without holder rewards. */
|
|
277
|
+
holderVault: Address | null;
|
|
278
|
+
}
|
|
279
|
+
/** `GET /v1/launches?sort=`: newest first by default; `rewards24h` most paid to holders in 24 h first; `fees` lowest buy-then-sell fee first. */
|
|
280
|
+
export type LaunchSort = 'new' | 'mcap' | 'volume' | 'trending' | 'graduated' | 'rewards24h' | 'fees';
|
|
281
|
+
/** `GET /v1/launches?rules=a,b`: only launches that have every rule listed (`custom_hook`: launched with a creator's own hook). */
|
|
282
|
+
export type RuleFilter = 'rewards' | 'burn' | 'max_wallet' | 'creator_lock' | 'early_lock' | 'custom_hook';
|
|
283
|
+
export interface LaunchList {
|
|
284
|
+
launches: LaunchSummary[];
|
|
285
|
+
total: number;
|
|
286
|
+
}
|
|
287
|
+
export interface Trade {
|
|
288
|
+
signature: string;
|
|
289
|
+
slot: number;
|
|
290
|
+
ts: number;
|
|
291
|
+
trader: Address;
|
|
292
|
+
side: Side;
|
|
293
|
+
baseAmount: Amount;
|
|
294
|
+
quoteAmount: Amount;
|
|
295
|
+
/** Whole quote per whole token, as executed. */
|
|
296
|
+
priceQuote: number;
|
|
297
|
+
priceUsd: number | null;
|
|
298
|
+
lpFeeBps: number;
|
|
299
|
+
/** The owner of the holding the output was delivered to. */
|
|
300
|
+
recipient: Address;
|
|
301
|
+
/** Lamports of bridged SOL paid to the creator. */
|
|
302
|
+
creatorFee: Amount;
|
|
303
|
+
/** Lamports of bridged SOL paid to holders as holder rewards. */
|
|
304
|
+
holderFee: Amount;
|
|
305
|
+
/** Token base units burned. */
|
|
306
|
+
burn: Amount;
|
|
307
|
+
}
|
|
308
|
+
/** `GET /v1/launches/:mint/candles?unit=usd|quote`: oldest first. In dollars, a candle no SOL price can tell (none when it traded, none now) is left out, never sent as 0. */
|
|
309
|
+
export interface Candle {
|
|
310
|
+
t: number;
|
|
311
|
+
o: number;
|
|
312
|
+
h: number;
|
|
313
|
+
l: number;
|
|
314
|
+
c: number;
|
|
315
|
+
/** Volume in the chart's unit (whole quote, or dollars). */
|
|
316
|
+
v: number;
|
|
317
|
+
}
|
|
318
|
+
export interface Holder {
|
|
319
|
+
owner: Address;
|
|
320
|
+
amount: Amount;
|
|
321
|
+
share: number;
|
|
322
|
+
label: 'pool' | 'launch' | 'creator' | null;
|
|
323
|
+
/** This owner earns holder rewards: false for the pool and the launch, and for every owner of a launch without them. */
|
|
324
|
+
earnsRewards: boolean;
|
|
325
|
+
}
|
|
326
|
+
export interface WalletBalances {
|
|
327
|
+
lamports: Amount;
|
|
328
|
+
bridgedSol: Amount;
|
|
329
|
+
token: Amount | null;
|
|
330
|
+
lp: Amount | null;
|
|
331
|
+
}
|
|
332
|
+
export interface PortfolioEntry {
|
|
333
|
+
mint: Address;
|
|
334
|
+
symbol: string;
|
|
335
|
+
name: string;
|
|
336
|
+
image: string | null;
|
|
337
|
+
decimals: number;
|
|
338
|
+
amount: Amount;
|
|
339
|
+
priceUsd: number | null;
|
|
340
|
+
valueUsd: number | null;
|
|
341
|
+
kind: 'launch' | 'bridged' | 'lp' | 'other';
|
|
342
|
+
launchStatus: LaunchStatus | null;
|
|
343
|
+
/** For a bridged asset: what it unwraps to. For an LP: its pool. */
|
|
344
|
+
link: Address | null;
|
|
345
|
+
/** Holder rewards the wallet can claim for this token, lamports; null when not known or not applicable. */
|
|
346
|
+
claimableRewards: Amount | null;
|
|
347
|
+
/** Tokens the wallet cannot sell or send yet, until when and why; null when none are locked. */
|
|
348
|
+
locked: {
|
|
349
|
+
amount: Amount;
|
|
350
|
+
until: number;
|
|
351
|
+
reason: 'creator_lock' | 'early_lock';
|
|
352
|
+
} | null;
|
|
353
|
+
/** For a launch token with a creator's own hook (§5.8): the hook, so the row can say so; null otherwise (absent from backends that predate it). */
|
|
354
|
+
customHook?: CustomHookInfo | null;
|
|
355
|
+
}
|
|
356
|
+
/** A launch the wallet created, with the creator fee waiting for it (`Portfolio.created`). */
|
|
357
|
+
export interface CreatedLaunch {
|
|
358
|
+
mint: Address;
|
|
359
|
+
symbol: string;
|
|
360
|
+
name: string;
|
|
361
|
+
image: string | null;
|
|
362
|
+
status: LaunchStatus;
|
|
363
|
+
creatorFeeBps: number;
|
|
364
|
+
/** Lamports of bridged SOL accrued and not yet claimed (the launch's quote holding, what a claim pays); null when the chain could not be read. */
|
|
365
|
+
claimable: Amount | null;
|
|
366
|
+
/** Lamports claimed here, all time; null when not known. */
|
|
367
|
+
claimedTotal?: Amount | null;
|
|
368
|
+
}
|
|
369
|
+
export interface Portfolio {
|
|
370
|
+
owner: Address;
|
|
371
|
+
lamports: Amount;
|
|
372
|
+
/** What the wallet holds, plus launches it no longer holds when it has holder rewards to claim there. */
|
|
373
|
+
entries: PortfolioEntry[];
|
|
374
|
+
totalUsd: number | null;
|
|
375
|
+
/** The launches this wallet created, those with fees to claim first (absent from backends that predate it). */
|
|
376
|
+
created: CreatedLaunch[];
|
|
377
|
+
}
|
|
378
|
+
/** Native SOL (bridged on the way in, unbridged on the way out) or bridged SOL already held. */
|
|
379
|
+
export type SolMode = 'SOL' | 'BSOL';
|
|
380
|
+
export interface SwapQuoteRequest {
|
|
381
|
+
mint: Address;
|
|
382
|
+
side: Side;
|
|
383
|
+
/** Input amount in base units: quote (bridged SOL) for a buy, the token for a sell. */
|
|
384
|
+
amount: Amount;
|
|
385
|
+
slippageBps: number;
|
|
386
|
+
}
|
|
387
|
+
export interface SwapQuote {
|
|
388
|
+
side: Side;
|
|
389
|
+
amountIn: Amount;
|
|
390
|
+
/** What reaches the wallet: after a buy's burn, or after a sell's creator and holder fees. */
|
|
391
|
+
amountOut: Amount;
|
|
392
|
+
minAmountOut: Amount;
|
|
393
|
+
lpFeeBps: number;
|
|
394
|
+
lpFee: Amount;
|
|
395
|
+
protocolFee: Amount;
|
|
396
|
+
creatorFee: Amount;
|
|
397
|
+
/** Bridged SOL paid to holders as holder rewards. */
|
|
398
|
+
holderFee: Amount;
|
|
399
|
+
/** Token base units burned. */
|
|
400
|
+
burn: Amount;
|
|
401
|
+
/** Total fee of this side by the §7.3 formula at this moment, the sniper fee included while elevated. */
|
|
402
|
+
totalFeeBps: number;
|
|
403
|
+
/** Whole quote per whole token, all fees and the burn included. */
|
|
404
|
+
effectivePrice: number;
|
|
405
|
+
/** Tokens the recipient can still receive under max wallet; null when no cap applies. */
|
|
406
|
+
maxWalletLeft: Amount | null;
|
|
407
|
+
/** The input that fills that allowance; null when no cap applies. */
|
|
408
|
+
maxInForWallet: Amount | null;
|
|
409
|
+
/** Why this trade cannot be made now, and until when (unix seconds); null when it can. */
|
|
410
|
+
blocked: {
|
|
411
|
+
reason: 'max_wallet' | 'creator_lock' | 'early_lock';
|
|
412
|
+
until: number | null;
|
|
413
|
+
} | null;
|
|
414
|
+
/** A buy in the early-buyer window: when its tokens unlock (unix seconds); null otherwise. */
|
|
415
|
+
lockedUntil: number | null;
|
|
416
|
+
/** Whole quote per whole token, as this trade would execute. */
|
|
417
|
+
priceQuote: number;
|
|
418
|
+
/** How far the curve moves the price for this trade, fees excluded (they are their own lines). */
|
|
419
|
+
priceImpactBps: number;
|
|
420
|
+
/** This buy crosses the graduation threshold; the backend appends the graduation to it. */
|
|
421
|
+
graduates: boolean;
|
|
422
|
+
/** The most that can be bought before the curve is empty, or null off the curve. */
|
|
423
|
+
maxAmountIn: Amount | null;
|
|
424
|
+
elevatedFee: boolean;
|
|
425
|
+
quoteUsd: number | null;
|
|
426
|
+
tradeUsd: number | null;
|
|
427
|
+
/**
|
|
428
|
+
* On a token with a creator's own hook (§5.8): what the hook took from this trade, measured by a
|
|
429
|
+
* dry run when the trade was prepared (base units of what you receive; `amountOut` and
|
|
430
|
+
* `minAmountOut` then follow what actually arrives). Null when not measured (a quote alone, or
|
|
431
|
+
* the dry run could not be made). Absent on every other token.
|
|
432
|
+
*/
|
|
433
|
+
hookCut?: Amount | null;
|
|
434
|
+
}
|
|
435
|
+
export interface SwapPrepareRequest extends SwapQuoteRequest {
|
|
436
|
+
owner: Address;
|
|
437
|
+
solMode: SolMode;
|
|
438
|
+
}
|
|
439
|
+
export interface PreparedTx {
|
|
440
|
+
/** Base64 of the unsigned transaction. */
|
|
441
|
+
transaction: string;
|
|
442
|
+
version: 'legacy' | 'v0';
|
|
443
|
+
stage: number;
|
|
444
|
+
label: string;
|
|
445
|
+
/** Keys the browser holds that must also sign (a launch's fresh mint). */
|
|
446
|
+
extraSigners: ('mint')[];
|
|
447
|
+
}
|
|
448
|
+
export interface SwapPrepareResponse {
|
|
449
|
+
transactions: PreparedTx[];
|
|
450
|
+
quote: SwapQuote;
|
|
451
|
+
}
|
|
452
|
+
export interface SubmitRequest {
|
|
453
|
+
transactions: {
|
|
454
|
+
transaction: string;
|
|
455
|
+
stage: number;
|
|
456
|
+
label: string;
|
|
457
|
+
}[];
|
|
458
|
+
mint?: Address;
|
|
459
|
+
intentId?: string;
|
|
460
|
+
}
|
|
461
|
+
export type TxState = 'waiting' | 'pending' | 'confirmed' | 'failed' | 'expired';
|
|
462
|
+
export interface TxStatus {
|
|
463
|
+
signature: string;
|
|
464
|
+
label: string;
|
|
465
|
+
stage: number;
|
|
466
|
+
state: TxState;
|
|
467
|
+
error: string | null;
|
|
468
|
+
}
|
|
469
|
+
export interface Submission {
|
|
470
|
+
id: string;
|
|
471
|
+
state: 'pending' | 'confirmed' | 'failed' | 'expired';
|
|
472
|
+
transactions: TxStatus[];
|
|
473
|
+
mint: Address | null;
|
|
474
|
+
error: string | null;
|
|
475
|
+
}
|
|
476
|
+
export interface UploadResponse {
|
|
477
|
+
uploadId: string;
|
|
478
|
+
metadataUri: string;
|
|
479
|
+
imageUri: string;
|
|
480
|
+
}
|
|
481
|
+
export interface LaunchPrepareRequest {
|
|
482
|
+
creator: Address;
|
|
483
|
+
uploadId: string;
|
|
484
|
+
creatorFeeBps: number;
|
|
485
|
+
/** Lamports of SOL the creator buys with in the same approval; 0 or absent for none. */
|
|
486
|
+
devBuyLamports?: Amount;
|
|
487
|
+
/** Token rules, fixed at launch; all zero for none (the backend also reads a request without them as none). */
|
|
488
|
+
rules: LaunchRulesInput;
|
|
489
|
+
/**
|
|
490
|
+
* Build your own (§5.7): the `LaunchConfig` to launch from. The backend reads it, checks it again
|
|
491
|
+
* and builds `create_launch` with it; `rules` and `creatorFeeBps` must then equal the config's
|
|
492
|
+
* (what the site showed is what launches), and a custom hook's accounts are resolved for `mint`.
|
|
493
|
+
*/
|
|
494
|
+
config?: Address;
|
|
495
|
+
}
|
|
496
|
+
export interface LaunchPrepareResponse {
|
|
497
|
+
intentId: string;
|
|
498
|
+
mint: Address;
|
|
499
|
+
transactions: PreparedTx[];
|
|
500
|
+
openingMcapUsd: number;
|
|
501
|
+
virtualQuote: Amount;
|
|
502
|
+
graduationQuote: Amount;
|
|
503
|
+
graduationMcapUsd: number;
|
|
504
|
+
/** The largest first buy, lamports, whose tokens stay within max wallet at the opening reserves with the creator's first-buy fees; null without max wallet. */
|
|
505
|
+
devBuyMaxLamports: Amount | null;
|
|
506
|
+
/** Total fee of a buy under these rules by the §7.3 formula, outside the sniper window. */
|
|
507
|
+
buyFeeBps: number;
|
|
508
|
+
/** Total fee of a sell under these rules by the §7.3 formula, outside the sniper window. */
|
|
509
|
+
sellFeeBps: number;
|
|
510
|
+
}
|
|
511
|
+
/** A wallet's holder rewards in one launch. */
|
|
512
|
+
export interface RewardPosition {
|
|
513
|
+
mint: Address;
|
|
514
|
+
symbol: string;
|
|
515
|
+
name: string;
|
|
516
|
+
image: string | null;
|
|
517
|
+
decimals: number;
|
|
518
|
+
/** Token base units the wallet holds now (0 when it sold out with rewards left to claim). */
|
|
519
|
+
balance: Amount;
|
|
520
|
+
/** Lamports a claim would pay now. */
|
|
521
|
+
claimable: Amount;
|
|
522
|
+
/** Lamports the wallet has claimed here, all time; null when not tracked. */
|
|
523
|
+
claimed: Amount | null;
|
|
524
|
+
}
|
|
525
|
+
export interface RewardsList {
|
|
526
|
+
owner: Address;
|
|
527
|
+
positions: RewardPosition[];
|
|
528
|
+
/** Lamports claimable across every position. */
|
|
529
|
+
totalClaimable: Amount;
|
|
530
|
+
}
|
|
531
|
+
/** Claim holder rewards: up to about 4 mints per transaction. */
|
|
532
|
+
export interface RewardsPrepareRequest {
|
|
533
|
+
owner: Address;
|
|
534
|
+
mints: Address[];
|
|
535
|
+
/** Unwrap the bridged SOL to SOL and close the temporary holding. */
|
|
536
|
+
unwrap: boolean;
|
|
537
|
+
}
|
|
538
|
+
/** Claim the creator fees of launches the owner created: up to about 4 mints per transaction, paid as SOL. */
|
|
539
|
+
export interface CreatorPrepareRequest {
|
|
540
|
+
owner: Address;
|
|
541
|
+
mints: Address[];
|
|
542
|
+
}
|
|
543
|
+
/** Share with holders: send SOL that every holder of the token receives pro rata. */
|
|
544
|
+
export interface SharePrepareRequest {
|
|
545
|
+
owner: Address;
|
|
546
|
+
mint: Address;
|
|
547
|
+
/** Lamports; at least 0.001 SOL. */
|
|
548
|
+
amount: Amount;
|
|
549
|
+
solMode: SolMode;
|
|
550
|
+
}
|
|
551
|
+
/** A claim or a share in one launch. */
|
|
552
|
+
export interface RewardEvent {
|
|
553
|
+
kind: 'claim' | 'share';
|
|
554
|
+
owner: Address;
|
|
555
|
+
/** Lamports. */
|
|
556
|
+
amount: Amount;
|
|
557
|
+
ts: number;
|
|
558
|
+
signature: string;
|
|
559
|
+
}
|
|
560
|
+
export interface BridgeAsset {
|
|
561
|
+
underlyingMint: Address;
|
|
562
|
+
underlyingProgram: Address;
|
|
563
|
+
wrappedMint: Address | null;
|
|
564
|
+
registered: boolean;
|
|
565
|
+
native: boolean;
|
|
566
|
+
symbol: string;
|
|
567
|
+
name: string;
|
|
568
|
+
image: string | null;
|
|
569
|
+
decimals: number;
|
|
570
|
+
totalWrapped: Amount | null;
|
|
571
|
+
/** Dollars per whole token: SOL from the SOL feed, any other mint from Jupiter's price API (mainnet only); null where none is known. */
|
|
572
|
+
priceUsd: number | null;
|
|
573
|
+
/** Price times the underlying mint's supply; null unless both are known. */
|
|
574
|
+
mcapUsd: number | null;
|
|
575
|
+
/** The underlying mint's supply in base units; null where it has not been read. */
|
|
576
|
+
supply: Amount | null;
|
|
577
|
+
featured: boolean;
|
|
578
|
+
/**
|
|
579
|
+
* The Bordrless DEX pool of the bridged version against bridged SOL, where it trades on the
|
|
580
|
+
* standard (the platform token's page charts and trades this one); null while none has been
|
|
581
|
+
* opened. Absent from backends that predate it.
|
|
582
|
+
*/
|
|
583
|
+
pool?: BridgePool | null;
|
|
584
|
+
}
|
|
585
|
+
/** A bridged token's pool on the DEX (`BridgeAsset.pool`): where it is, since when, and its last price. */
|
|
586
|
+
export interface BridgePool {
|
|
587
|
+
address: Address;
|
|
588
|
+
/** Unix seconds the pool was opened. */
|
|
589
|
+
createdAt: number;
|
|
590
|
+
/** Unix seconds of its last indexed trade; null before the first. */
|
|
591
|
+
lastTradeAt: number | null;
|
|
592
|
+
/** Whole bridged SOL per whole token at the last trade (or from the reserves); null when it cannot be read. */
|
|
593
|
+
priceQuote: number | null;
|
|
594
|
+
/** The same in dollars; null without a SOL price. */
|
|
595
|
+
priceUsd: number | null;
|
|
596
|
+
lpFeeBps: number;
|
|
597
|
+
/** The flat protocol rate of the quote on this pool (ordinary pools; 0 under the share model). */
|
|
598
|
+
protocolFeeBps: number;
|
|
599
|
+
baseReserve: Amount;
|
|
600
|
+
quoteReserve: Amount;
|
|
601
|
+
volume24hUsd: number | null;
|
|
602
|
+
}
|
|
603
|
+
export interface BridgeAssets {
|
|
604
|
+
assets: BridgeAsset[];
|
|
605
|
+
}
|
|
606
|
+
export interface BridgeBalances {
|
|
607
|
+
underlying: Amount;
|
|
608
|
+
wrapped: Amount;
|
|
609
|
+
}
|
|
610
|
+
export interface BridgePrepareRequest {
|
|
611
|
+
owner: Address;
|
|
612
|
+
underlyingMint: Address;
|
|
613
|
+
direction: 'wrap' | 'unwrap';
|
|
614
|
+
amount: Amount;
|
|
615
|
+
}
|
|
616
|
+
export interface BridgePrepareResponse {
|
|
617
|
+
transactions: PreparedTx[];
|
|
618
|
+
/** The asset was not registered yet; the transaction registers it first (the owner pays the rent). */
|
|
619
|
+
registers: boolean;
|
|
620
|
+
}
|
|
621
|
+
export interface PoolSummary {
|
|
622
|
+
pool: Address;
|
|
623
|
+
baseMint: Address;
|
|
624
|
+
quoteMint: Address;
|
|
625
|
+
baseSymbol: string;
|
|
626
|
+
quoteSymbol: string;
|
|
627
|
+
baseImage: string | null;
|
|
628
|
+
baseDecimals: number;
|
|
629
|
+
quoteDecimals: number;
|
|
630
|
+
lpMint: Address;
|
|
631
|
+
lpFeeBps: number;
|
|
632
|
+
/** The flat protocol rate of the quote; 0 under the share model. */
|
|
633
|
+
protocolFeeBps: number;
|
|
634
|
+
/** How Bordrless is paid on this pool (§3.1); absent from backends that predate the share model, which the site reads as 'flat'. */
|
|
635
|
+
protocolModel?: ProtocolModel;
|
|
636
|
+
/** Under the share model, Bordrless's share of what the hooks cut, in basis points; null (or absent) under the flat model. */
|
|
637
|
+
protocolShareBps?: number | null;
|
|
638
|
+
hookProgram: Address | null;
|
|
639
|
+
/** The base token's creator-written hook (§5.8), for a launch pool whose token has one; null or absent otherwise. */
|
|
640
|
+
customHook?: CustomHookInfo | null;
|
|
641
|
+
curve: boolean;
|
|
642
|
+
baseReserve: Amount;
|
|
643
|
+
quoteReserve: Amount;
|
|
644
|
+
lpSupply: Amount;
|
|
645
|
+
tvlUsd: number | null;
|
|
646
|
+
volume24hUsd: number | null;
|
|
647
|
+
createdAt: number;
|
|
648
|
+
launchMint: Address | null;
|
|
649
|
+
}
|
|
650
|
+
export interface PoolList {
|
|
651
|
+
pools: PoolSummary[];
|
|
652
|
+
}
|
|
653
|
+
export interface LiquidityQuoteRequest {
|
|
654
|
+
pool: Address;
|
|
655
|
+
action: 'add' | 'remove';
|
|
656
|
+
baseAmount?: Amount;
|
|
657
|
+
quoteAmount?: Amount;
|
|
658
|
+
lpAmount?: Amount;
|
|
659
|
+
}
|
|
660
|
+
export interface LiquidityQuote {
|
|
661
|
+
action: 'add' | 'remove';
|
|
662
|
+
baseAmount: Amount;
|
|
663
|
+
quoteAmount: Amount;
|
|
664
|
+
lpAmount: Amount;
|
|
665
|
+
/** Share of the pool after the action, 0 to 1. */
|
|
666
|
+
share: number;
|
|
667
|
+
}
|
|
668
|
+
export interface LiquidityPrepareRequest extends LiquidityQuoteRequest {
|
|
669
|
+
owner: Address;
|
|
670
|
+
slippageBps: number;
|
|
671
|
+
}
|
|
672
|
+
export interface LiquidityPrepareResponse {
|
|
673
|
+
transactions: PreparedTx[];
|
|
674
|
+
quote: LiquidityQuote;
|
|
675
|
+
}
|
|
676
|
+
export interface ApiErrorBody {
|
|
677
|
+
error: string;
|
|
678
|
+
code?: string;
|
|
679
|
+
}
|
package/dist/api.js
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED