@bropump/sdk 0.2.2 → 0.2.3
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 +21 -0
- package/README.md +15 -12
- package/dist/client.js +73 -4
- package/dist/types.d.ts +9 -9
- package/package.json +7 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BroPump
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bropump/sdk
|
|
2
2
|
|
|
3
|
-
TypeScript SDK for
|
|
3
|
+
TypeScript SDK for BroPump launches, fee previews, and realtime launch sessions.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -33,23 +33,23 @@ const client = new BroPumpClient({
|
|
|
33
33
|
})
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Launch Modes
|
|
37
37
|
|
|
38
|
-
Launch
|
|
38
|
+
Launch modes are the current available token fee, liquidity, and bonding setups.
|
|
39
39
|
|
|
40
|
-
Fetch the currently available modes from the API:
|
|
40
|
+
Fetch the currently available launch modes from the API:
|
|
41
41
|
|
|
42
42
|
```ts
|
|
43
43
|
const launchConfig = await client.launchConfig.get()
|
|
44
44
|
|
|
45
|
-
console.log(launchConfig.
|
|
46
|
-
console.log(launchConfig.
|
|
47
|
-
console.log(launchConfig.
|
|
45
|
+
console.log(launchConfig.defaultLaunchMode)
|
|
46
|
+
console.log(launchConfig.availableLaunchModes)
|
|
47
|
+
console.log(launchConfig.launchModeOptions)
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
Each option includes:
|
|
51
51
|
|
|
52
|
-
- `
|
|
52
|
+
- `launchMode`, for example `MAINNET_CONFIG_25`
|
|
53
53
|
- `migrationThreshold`, the resolved quote target behind that mode
|
|
54
54
|
- `configAddress`
|
|
55
55
|
- `deploymentMode`
|
|
@@ -67,7 +67,7 @@ const token = await client.tokens.create({
|
|
|
67
67
|
symbol: 'BRO',
|
|
68
68
|
description: 'Simple token flow',
|
|
69
69
|
deployer: 'YOUR_WALLET',
|
|
70
|
-
|
|
70
|
+
launchMode: 'DEVNET_CONFIG_1',
|
|
71
71
|
firstBuyAmount: 0.25,
|
|
72
72
|
image: new Blob(['demo'], { type: 'image/png' }),
|
|
73
73
|
})
|
|
@@ -96,12 +96,12 @@ try {
|
|
|
96
96
|
|
|
97
97
|
```ts
|
|
98
98
|
const preview = await client.fees.preview({
|
|
99
|
-
|
|
99
|
+
launchMode: 'MAINNET_CONFIG_25',
|
|
100
100
|
firstBuyAmount: 0.5,
|
|
101
101
|
deployerWallet: 'YOUR_WALLET',
|
|
102
102
|
})
|
|
103
103
|
|
|
104
|
-
console.log(preview.
|
|
104
|
+
console.log(preview.selectedLaunchMode)
|
|
105
105
|
console.log(preview.curve.migrationThreshold)
|
|
106
106
|
console.log(preview.costQuote.recommendedMinBalanceSol)
|
|
107
107
|
```
|
|
@@ -124,7 +124,7 @@ All wait helpers accept:
|
|
|
124
124
|
## Realtime / WSS
|
|
125
125
|
|
|
126
126
|
You do not need to manage a separate websocket host manually. The SDK derives `ws://` or `wss://`
|
|
127
|
-
from the API base URL automatically
|
|
127
|
+
from the API base URL automatically for both `mainnet` and `devnet`.
|
|
128
128
|
|
|
129
129
|
### Watch a Token Session
|
|
130
130
|
|
|
@@ -177,6 +177,9 @@ Common message types:
|
|
|
177
177
|
- `runtime_snapshot`
|
|
178
178
|
- `runtime_update`
|
|
179
179
|
|
|
180
|
+
Use `client.tokens.watch(tokenId)` for a launch session and `client.tokens.watchPool(poolAddress)`
|
|
181
|
+
for a live pool stream.
|
|
182
|
+
|
|
180
183
|
## Manual WSS URL Access
|
|
181
184
|
|
|
182
185
|
If you need the derived websocket URL for your own socket layer, use `buildWebSocketUrl`:
|
package/dist/client.js
CHANGED
|
@@ -123,19 +123,21 @@ export class BroPumpClient {
|
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
async previewFees(input, options) {
|
|
126
|
-
|
|
126
|
+
const preview = await this.request({
|
|
127
127
|
path: '/fees/preview',
|
|
128
128
|
method: 'POST',
|
|
129
|
-
body: input
|
|
129
|
+
body: buildFeePreviewPayload(input),
|
|
130
130
|
options,
|
|
131
131
|
});
|
|
132
|
+
return normalizeCurvePreview(preview);
|
|
132
133
|
}
|
|
133
134
|
async getLaunchConfig(options) {
|
|
134
|
-
|
|
135
|
+
const launchConfig = await this.request({
|
|
135
136
|
path: '/launch-config',
|
|
136
137
|
method: 'GET',
|
|
137
138
|
options,
|
|
138
139
|
});
|
|
140
|
+
return normalizeLaunchConfigView(launchConfig);
|
|
139
141
|
}
|
|
140
142
|
async getWalletBalance(address, options) {
|
|
141
143
|
return this.request({
|
|
@@ -198,7 +200,8 @@ function buildCreateTokenFormData(input) {
|
|
|
198
200
|
appendFormValue(form, 'symbol', input.symbol);
|
|
199
201
|
appendFormValue(form, 'description', input.description);
|
|
200
202
|
appendFormValue(form, 'deployer', input.deployer);
|
|
201
|
-
appendFormValue(form, '
|
|
203
|
+
appendFormValue(form, 'launchMode', input.launchMode);
|
|
204
|
+
appendFormValue(form, 'configMode', input.launchMode);
|
|
202
205
|
appendFormValue(form, 'firstBuyAmount', input.firstBuyAmount);
|
|
203
206
|
appendFormValue(form, 'x', input.x);
|
|
204
207
|
appendFormValue(form, 'website', input.website);
|
|
@@ -212,6 +215,72 @@ function appendFormValue(form, key, value) {
|
|
|
212
215
|
return;
|
|
213
216
|
form.set(key, String(value));
|
|
214
217
|
}
|
|
218
|
+
function buildFeePreviewPayload(input) {
|
|
219
|
+
if (!input)
|
|
220
|
+
return {};
|
|
221
|
+
return {
|
|
222
|
+
...input,
|
|
223
|
+
...(input.launchMode ? { configMode: input.launchMode } : {}),
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function normalizeLaunchModeOption(input) {
|
|
227
|
+
const launchMode = typeof input.launchMode === 'string'
|
|
228
|
+
? input.launchMode
|
|
229
|
+
: typeof input.configMode === 'string'
|
|
230
|
+
? input.configMode
|
|
231
|
+
: '';
|
|
232
|
+
return {
|
|
233
|
+
launchMode,
|
|
234
|
+
migrationThreshold: Number(input.migrationThreshold ?? 0),
|
|
235
|
+
configAddress: typeof input.configAddress === 'string' || input.configAddress === null
|
|
236
|
+
? input.configAddress
|
|
237
|
+
: null,
|
|
238
|
+
deploymentMode: input.deploymentMode === 'per-launch-config' ? 'per-launch-config' : 'predeployed-config',
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function normalizeLaunchConfigView(input) {
|
|
242
|
+
const optionRows = Array.isArray(input.launchModeOptions)
|
|
243
|
+
? input.launchModeOptions
|
|
244
|
+
: Array.isArray(input.configModeOptions)
|
|
245
|
+
? input.configModeOptions
|
|
246
|
+
: [];
|
|
247
|
+
const launchModeOptions = optionRows
|
|
248
|
+
.filter((value) => Boolean(value) && typeof value === 'object')
|
|
249
|
+
.map(normalizeLaunchModeOption);
|
|
250
|
+
return {
|
|
251
|
+
network: input.network === 'devnet' ? 'devnet' : 'mainnet',
|
|
252
|
+
defaultLaunchMode: typeof input.defaultLaunchMode === 'string'
|
|
253
|
+
? input.defaultLaunchMode
|
|
254
|
+
: typeof input.defaultConfigMode === 'string'
|
|
255
|
+
? input.defaultConfigMode
|
|
256
|
+
: launchModeOptions[0]?.launchMode || '',
|
|
257
|
+
availableLaunchModes: Array.isArray(input.availableLaunchModes)
|
|
258
|
+
? input.availableLaunchModes.filter((value) => typeof value === 'string')
|
|
259
|
+
: Array.isArray(input.availableConfigModes)
|
|
260
|
+
? input.availableConfigModes.filter((value) => typeof value === 'string')
|
|
261
|
+
: launchModeOptions.map((option) => option.launchMode),
|
|
262
|
+
launchModeOptions,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function normalizeCurvePreview(input) {
|
|
266
|
+
const optionRows = Array.isArray(input.launchModeOptions)
|
|
267
|
+
? input.launchModeOptions
|
|
268
|
+
: Array.isArray(input.configModeOptions)
|
|
269
|
+
? input.configModeOptions
|
|
270
|
+
: [];
|
|
271
|
+
const launchModeOptions = optionRows
|
|
272
|
+
.filter((value) => Boolean(value) && typeof value === 'object')
|
|
273
|
+
.map(normalizeLaunchModeOption);
|
|
274
|
+
return {
|
|
275
|
+
...input,
|
|
276
|
+
launchModeOptions,
|
|
277
|
+
selectedLaunchMode: typeof input.selectedLaunchMode === 'string'
|
|
278
|
+
? input.selectedLaunchMode
|
|
279
|
+
: typeof input.selectedConfigMode === 'string'
|
|
280
|
+
? input.selectedConfigMode
|
|
281
|
+
: launchModeOptions[0]?.launchMode || '',
|
|
282
|
+
};
|
|
283
|
+
}
|
|
215
284
|
function toImagePart(image) {
|
|
216
285
|
if (isBlob(image)) {
|
|
217
286
|
return {
|
package/dist/types.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export type CreateTokenInput = {
|
|
|
38
38
|
symbol: string;
|
|
39
39
|
description: string;
|
|
40
40
|
deployer: string;
|
|
41
|
-
|
|
41
|
+
launchMode?: string;
|
|
42
42
|
firstBuyAmount?: number;
|
|
43
43
|
x?: string;
|
|
44
44
|
website?: string;
|
|
@@ -90,17 +90,17 @@ export type LaunchCostQuote = {
|
|
|
90
90
|
};
|
|
91
91
|
breakdown: LaunchCostBreakdown;
|
|
92
92
|
};
|
|
93
|
-
export type
|
|
94
|
-
|
|
93
|
+
export type LaunchModeOption = {
|
|
94
|
+
launchMode: string;
|
|
95
95
|
migrationThreshold: number;
|
|
96
96
|
configAddress: string | null;
|
|
97
97
|
deploymentMode: 'predeployed-config' | 'per-launch-config';
|
|
98
98
|
};
|
|
99
99
|
export type LaunchConfigView = {
|
|
100
100
|
network: 'devnet' | 'mainnet';
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
defaultLaunchMode: string;
|
|
102
|
+
availableLaunchModes: string[];
|
|
103
|
+
launchModeOptions: LaunchModeOption[];
|
|
104
104
|
};
|
|
105
105
|
export type SubmitAction = {
|
|
106
106
|
id: string;
|
|
@@ -157,8 +157,8 @@ export type RealtimeMessage<T> = {
|
|
|
157
157
|
data: T | null;
|
|
158
158
|
};
|
|
159
159
|
export type CurvePreview = {
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
launchModeOptions: LaunchModeOption[];
|
|
161
|
+
selectedLaunchMode: string;
|
|
162
162
|
curve: {
|
|
163
163
|
startingMC: number;
|
|
164
164
|
endingMC: number;
|
|
@@ -199,7 +199,7 @@ export type CurvePreview = {
|
|
|
199
199
|
};
|
|
200
200
|
export type FeePreviewRequest = {
|
|
201
201
|
totalSupply?: string;
|
|
202
|
-
|
|
202
|
+
launchMode?: string;
|
|
203
203
|
firstBuyAmount?: number;
|
|
204
204
|
deployerWallet?: string;
|
|
205
205
|
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bropump/sdk",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "TypeScript SDK for
|
|
5
|
-
"license": "
|
|
3
|
+
"version": "0.2.3",
|
|
4
|
+
"description": "TypeScript SDK for BroPump launches, fee previews, and realtime sessions",
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
|
-
"README.md"
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
13
14
|
],
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
@@ -21,7 +22,8 @@
|
|
|
21
22
|
"sdk",
|
|
22
23
|
"typescript",
|
|
23
24
|
"api",
|
|
24
|
-
"
|
|
25
|
+
"launches",
|
|
26
|
+
"solana"
|
|
25
27
|
],
|
|
26
28
|
"engines": {
|
|
27
29
|
"node": ">=18"
|