@pump-fun/pump-sdk 1.0.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 ADDED
@@ -0,0 +1,211 @@
1
+ # Test Common Utilities
2
+
3
+ A template package demonstrating GitHub Actions workflow for npm package deployment. Use this as a base for creating new private npm packages.
4
+
5
+ ## Features
6
+
7
+ - Automated versioning and deployment
8
+ - Branch-based deployment (main/devnet)
9
+ - Semantic versioning support
10
+ - GitHub Actions workflow template
11
+
12
+ ## Installation
13
+
14
+ Since this is a private package, you'll need to be authenticated to install it:
15
+
16
+ ```bash
17
+ # Install the main version
18
+ npm install @pump-fun/test-common-util@main
19
+
20
+ # Or install the devnet version
21
+ npm install @pump-fun/test-common-util@devnet
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```typescript
27
+ import { helloWorld } from "@pump-fun/test-common-util";
28
+
29
+ console.log(helloWorld()); // Output: Hello, World!
30
+ console.log(helloWorld("Alice")); // Output: Hello, Alice!
31
+ ```
32
+
33
+ ## Development
34
+
35
+ 1. Install dependencies:
36
+
37
+ ```bash
38
+ npm install
39
+ ```
40
+
41
+ 2. Build the package:
42
+
43
+ ```bash
44
+ npm run build
45
+ ```
46
+
47
+ ## Deployment Process
48
+
49
+ ### Prerequisites
50
+
51
+ - `NPM_TOKEN`: Required for publishing to npm (add to GitHub Secrets)
52
+
53
+ ### Branch Strategy
54
+
55
+ - `devnet`: Development branch
56
+ - Auto-increments patch version on push
57
+ - Publishes with `devnet` tag
58
+ - `main`: Production branch
59
+ - Promotes latest devnet version to `latest` tag
60
+ - No version increment
61
+
62
+ ### Commit Message Format
63
+
64
+ ```
65
+ type(scope): description
66
+
67
+ [optional body]
68
+
69
+ [optional footer]
70
+ ```
71
+
72
+ Types:
73
+
74
+ - `feat`: New feature (minor version bump)
75
+ - `fix`: Bug fix (patch version bump)
76
+ - `BREAKING CHANGE` (in footer): Major version bump
77
+ - Other types: No version bump
78
+
79
+ Breaking Change Example:
80
+
81
+ ```
82
+ feat(utils): add new helper function
83
+
84
+ This adds a new utility function for string manipulation.
85
+
86
+ BREAKING CHANGE: Removes deprecated API
87
+ ```
88
+
89
+ Push changes using: https://github.com/pump-fun/github-rules-test
90
+
91
+ ## Using as Template
92
+
93
+ 1. Fork this repository
94
+
95
+ ```
96
+ git clone https://github.com/pump-fun/test-common-util.git
97
+ cd test-common-util
98
+ git remote remove origin
99
+ git remote add origin https://github.com/pump-fun/YOUR_REPO_NAME.git
100
+ ```
101
+
102
+ 2. Update package name and repo in `package.json`
103
+
104
+ ```
105
+ "name": "@pump-fun/YOUR_PACKAGE_NAME",
106
+ "version": "1.0.0",
107
+ "description": "Test common utilities package",
108
+ "keywords": [],
109
+ "homepage": "https://github.com/pump-fun/YOUR_REPO_NAME#readme",
110
+ "bugs": {
111
+ "url": "https://github.com/pump-fun/YOUR_REPO_NAME/issues"
112
+ },
113
+ "repository": {
114
+ "type": "git",
115
+ "url": "git+https://github.com/pump-fun/YOUR_REPO_NAME.git"
116
+ }
117
+ ```
118
+
119
+ 3. Add required secrets:
120
+ - ~~`NPM_TOKEN`: For npm publishing~~ (already done via org secrets)
121
+ 4. Test local build
122
+
123
+ ```
124
+ npm i
125
+ npm run build
126
+ ```
127
+
128
+ 5. Create `devnet` branch and push to your repository
129
+
130
+ ```
131
+ git checkout -b devnet
132
+ git add .
133
+ git commit -m "chore: initial commit"
134
+ git push origin devnet
135
+ ```
136
+
137
+ 6. Once `devnet` is deployed, merge to `main` via a PR
138
+
139
+ ```
140
+ git checkout main
141
+ git merge origin/devnet
142
+ git push
143
+ ```
144
+
145
+ The workflow will handle versioning and deployment automatically based on your commit messages and branch.
146
+
147
+ Your package should now be deployed to our NPM org with v1.0.0.
148
+
149
+ ## Consuming Package In Another Repo
150
+
151
+ ### Local Testing
152
+
153
+ 1. In your NPM package, run `npm link`
154
+ 2. In the consuming repo `package.json`, add the dependency:
155
+
156
+ ```
157
+ "dependencies": {
158
+ ...
159
+ "@pump-fun/YOUR_PACKAGE_NAME": "file:<path_to_your_local_package>",
160
+ ...
161
+ },
162
+ ```
163
+
164
+ 3. In the consuming repo run `npm i`
165
+ 4. You should be able to import and test package
166
+
167
+ ### Deploying Your Repo Consuming the Private Package
168
+
169
+ 1. Authenticate with NPM token in your build step. Github eg.:
170
+
171
+ ```
172
+ - name: NPM Auth
173
+ run: |
174
+ echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
175
+ ```
176
+
177
+ 2. If built in AWS via docker, update docker build to consume NPM_TOKEN
178
+
179
+ ```
180
+ - name: Build and push Docker image
181
+ env:
182
+ ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
183
+ ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }}
184
+ IMAGE_TAG: ${{ github.sha }}
185
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }} <--------
186
+ run: |
187
+ docker build . --build-arg NPM_TOKEN=$NPM_TOKEN \ <--------
188
+ -t $ECR_REGISTRY/$ECR_REPOSITORY:latest \
189
+ -t $ECR_REGISTRY/$ECR_REPOSITORY:${{ env.IMAGE_TAG }}
190
+ docker push --all-tags $ECR_REGISTRY/$ECR_REPOSITORY
191
+ ```
192
+
193
+ 3. Update Dockerfile to authenticate with NPM as well
194
+ Top of file
195
+
196
+ ```
197
+ WORKDIR /app
198
+
199
+ # Accept NPM token as a build argument
200
+ ARG NPM_TOKEN
201
+ ```
202
+
203
+ Before npm i or npm ci
204
+
205
+ ```
206
+ RUN echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
207
+
208
+ 4. For Frontend Repos, just add NPM_TOKEN to env var in Vercel
209
+ ```
210
+
211
+ Reach out to @aakash-baton with any questions.
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@pump-fun/pump-sdk",
3
+ "version": "1.0.0",
4
+ "description": "Pump Bonding Curve SDK",
5
+ "keywords": [],
6
+ "homepage": "https://github.com/pump-fun/pump-sdk#readme",
7
+ "bugs": {
8
+ "url": "https://github.com/pump-fun/pump-sdk/issues"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/pump-fun/pump-sdk.git"
13
+ },
14
+ "license": "MIT",
15
+ "author": "pump-fun",
16
+ "main": "./dist/index.js",
17
+ "module": "./dist/esm/index.js",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "require": "./dist/index.js",
22
+ "import": "./dist/esm/index.js"
23
+ },
24
+ "./*": {
25
+ "types": "./dist/*/index.d.ts",
26
+ "require": "./dist/*/index.js",
27
+ "import": "./dist/*/index.js"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "src"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsup --clean --dts",
36
+ "dev": "tsup --watch",
37
+ "clean": "rm -rf dist",
38
+ "test": "echo \"No tests specified\""
39
+ },
40
+ "dependencies": {
41
+ "undici-types": "^6.20.0"
42
+ },
43
+ "devDependencies": {
44
+ "@semantic-release/git": "^10.0.1",
45
+ "cz-conventional-changelog": "^3.3.0",
46
+ "semantic-release": "^24.2.3",
47
+ "@types/node": "^20.0.0",
48
+ "tsup": "^8.0.0",
49
+ "typescript": "^5.0.0"
50
+ },
51
+ "publishConfig": {
52
+ "access": "restricted"
53
+ },
54
+ "config": {
55
+ "commitizen": {
56
+ "path": "./node_modules/cz-conventional-changelog"
57
+ }
58
+ },
59
+ "release": {
60
+ "plugins": [
61
+ "@semantic-release/commit-analyzer",
62
+ "@semantic-release/release-notes-generator",
63
+ "@semantic-release/npm"
64
+ ],
65
+ "branches": [
66
+ {
67
+ "name": "main"
68
+ },
69
+ {
70
+ "name": "devnet",
71
+ "prerelease": true
72
+ }
73
+ ]
74
+ }
75
+ }
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A simple hello world function
3
+ * @param name - The name to greet
4
+ * @returns A greeting message
5
+ */
6
+ export function helloWorld(name: string = "World"): string {
7
+ return `Hello World and ${name}!!`;
8
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./math";
2
+ export * from "./types";
@@ -0,0 +1,20 @@
1
+ import { MathOperation } from "./types";
2
+
3
+ export function calculate(
4
+ a: number,
5
+ b: number,
6
+ operation: MathOperation
7
+ ): number {
8
+ switch (operation) {
9
+ case "add":
10
+ return a + b;
11
+ case "subtract":
12
+ return a - b;
13
+ case "multiply":
14
+ return a * b;
15
+ case "divide":
16
+ return a / b;
17
+ default:
18
+ throw new Error(`Invalid operation: ${operation}`);
19
+ }
20
+ }
@@ -0,0 +1 @@
1
+ export type MathOperation = "add" | "subtract" | "multiply" | "divide";