@gala-chain/launchpad-sdk 0.4.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +628 -0
  3. package/dist/LaunchpadSDK.d.ts +573 -0
  4. package/dist/LaunchpadSDK.d.ts.map +1 -0
  5. package/dist/api/CommentAPI.d.ts +119 -0
  6. package/dist/api/CommentAPI.d.ts.map +1 -0
  7. package/dist/api/LaunchpadAPI.d.ts +440 -0
  8. package/dist/api/LaunchpadAPI.d.ts.map +1 -0
  9. package/dist/api/TradeAPI.d.ts +164 -0
  10. package/dist/api/TradeAPI.d.ts.map +1 -0
  11. package/dist/api/Trading.d.ts +176 -0
  12. package/dist/api/Trading.d.ts.map +1 -0
  13. package/dist/api/UserAPI.d.ts +426 -0
  14. package/dist/api/UserAPI.d.ts.map +1 -0
  15. package/dist/api/WebSocketAPI.d.ts +156 -0
  16. package/dist/api/WebSocketAPI.d.ts.map +1 -0
  17. package/dist/api/dto/BondingCurveDTOs.d.ts +142 -0
  18. package/dist/api/dto/BondingCurveDTOs.d.ts.map +1 -0
  19. package/dist/api/services/BundleService.d.ts +105 -0
  20. package/dist/api/services/BundleService.d.ts.map +1 -0
  21. package/dist/api/services/SignatureService.d.ts +71 -0
  22. package/dist/api/services/SignatureService.d.ts.map +1 -0
  23. package/dist/api/services/TokenClassKeyService.d.ts +116 -0
  24. package/dist/api/services/TokenClassKeyService.d.ts.map +1 -0
  25. package/dist/api/services/WebSocketManager.d.ts +99 -0
  26. package/dist/api/services/WebSocketManager.d.ts.map +1 -0
  27. package/dist/api/services/WebSocketService.d.ts +66 -0
  28. package/dist/api/services/WebSocketService.d.ts.map +1 -0
  29. package/dist/auth/SignatureAuth.d.ts +92 -0
  30. package/dist/auth/SignatureAuth.d.ts.map +1 -0
  31. package/dist/auth/types.d.ts +41 -0
  32. package/dist/auth/types.d.ts.map +1 -0
  33. package/dist/helpers/sdk.d.ts +75 -0
  34. package/dist/helpers/sdk.d.ts.map +1 -0
  35. package/dist/helpers/wallet.d.ts +60 -0
  36. package/dist/helpers/wallet.d.ts.map +1 -0
  37. package/dist/index.cjs.js +1 -0
  38. package/dist/index.d.ts +49 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.esm.js +1 -0
  41. package/dist/index.js +1 -0
  42. package/dist/types/comment.dto.d.ts +160 -0
  43. package/dist/types/comment.dto.d.ts.map +1 -0
  44. package/dist/types/common.d.ts +108 -0
  45. package/dist/types/common.d.ts.map +1 -0
  46. package/dist/types/dto.d.ts +145 -0
  47. package/dist/types/dto.d.ts.map +1 -0
  48. package/dist/types/launchpad.dto.d.ts +517 -0
  49. package/dist/types/launchpad.dto.d.ts.map +1 -0
  50. package/dist/types/launchpad.validation.d.ts +40 -0
  51. package/dist/types/launchpad.validation.d.ts.map +1 -0
  52. package/dist/types/trade.dto.d.ts +446 -0
  53. package/dist/types/trade.dto.d.ts.map +1 -0
  54. package/dist/types/user.dto.d.ts +330 -0
  55. package/dist/types/user.dto.d.ts.map +1 -0
  56. package/dist/utils/VaultCache.d.ts +73 -0
  57. package/dist/utils/VaultCache.d.ts.map +1 -0
  58. package/dist/utils/adapters.d.ts +111 -0
  59. package/dist/utils/adapters.d.ts.map +1 -0
  60. package/dist/utils/agent-config.d.ts +206 -0
  61. package/dist/utils/agent-config.d.ts.map +1 -0
  62. package/dist/utils/http.d.ts +85 -0
  63. package/dist/utils/http.d.ts.map +1 -0
  64. package/dist/utils/multipart.d.ts +60 -0
  65. package/dist/utils/multipart.d.ts.map +1 -0
  66. package/dist/utils/precision-math.d.ts +37 -0
  67. package/dist/utils/precision-math.d.ts.map +1 -0
  68. package/dist/utils/validation.d.ts +131 -0
  69. package/dist/utils/validation.d.ts.map +1 -0
  70. package/dist/utils/wallet.d.ts +174 -0
  71. package/dist/utils/wallet.d.ts.map +1 -0
  72. package/package.json +151 -0
@@ -0,0 +1,174 @@
1
+ import { Wallet } from 'ethers';
2
+ /**
3
+ * Generated wallet information
4
+ */
5
+ export interface GeneratedWallet {
6
+ /** The private key (0x prefixed) */
7
+ privateKey: string;
8
+ /** The Ethereum address (0x prefixed) */
9
+ address: string;
10
+ /** The address in Gala backend format (eth|address) */
11
+ galaAddress: string;
12
+ /** The mnemonic phrase for backup/recovery */
13
+ mnemonic: string;
14
+ /** The ethers Wallet instance */
15
+ wallet: Wallet;
16
+ }
17
+ /**
18
+ * Wallet generation and utility functions for the Launchpad SDK
19
+ *
20
+ * Provides convenient methods for creating new wallets and converting
21
+ * between different address formats used by the Gala ecosystem.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * import { WalletUtils } from '@gala-chain/launchpad-sdk';
26
+ *
27
+ * // Generate a new wallet
28
+ * const newWallet = WalletUtils.generateWallet();
29
+ * console.log('Address:', newWallet.address);
30
+ * console.log('Gala Address:', newWallet.galaAddress);
31
+ * console.log('Mnemonic:', newWallet.mnemonic);
32
+ *
33
+ * // Convert existing address to Gala format
34
+ * const galaAddr = WalletUtils.toGalaAddress('0x1234...');
35
+ * ```
36
+ */
37
+ export declare class WalletUtils {
38
+ private static testCounter;
39
+ /**
40
+ * Generates a new random Ethereum wallet
41
+ *
42
+ * Creates a secure random wallet with mnemonic phrase backup.
43
+ * The wallet can be used immediately with the LaunchpadSDK.
44
+ *
45
+ * @returns GeneratedWallet Complete wallet information
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const wallet = WalletUtils.generateWallet();
50
+ *
51
+ * // Use with SDK
52
+ * const sdk = new LaunchpadSDK({ wallet: wallet.wallet });
53
+ *
54
+ * // Access wallet info
55
+ * console.log('Private Key:', wallet.privateKey);
56
+ * console.log('Address:', wallet.address);
57
+ * console.log('Gala Address:', wallet.galaAddress);
58
+ * console.log('Recovery phrase:', wallet.mnemonic);
59
+ * ```
60
+ */
61
+ static generateWallet(): GeneratedWallet;
62
+ /**
63
+ * Creates a wallet from a private key
64
+ *
65
+ * @param privateKey The private key (with or without 0x prefix)
66
+ * @returns GeneratedWallet Wallet information (mnemonic will be empty)
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const wallet = WalletUtils.fromPrivateKey('0x1234...');
71
+ * const sdk = new LaunchpadSDK({ wallet: wallet.wallet });
72
+ * ```
73
+ */
74
+ static fromPrivateKey(privateKey: string): GeneratedWallet;
75
+ /**
76
+ * Creates a wallet from a mnemonic phrase
77
+ *
78
+ * @param mnemonic The mnemonic phrase (12 or 24 words)
79
+ * @param index The derivation index (default: 0)
80
+ * @returns GeneratedWallet Wallet information
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * const wallet = WalletUtils.fromMnemonic('word1 word2 ... word12');
85
+ * const sdk = new LaunchpadSDK({ wallet: wallet.wallet });
86
+ * ```
87
+ */
88
+ static fromMnemonic(mnemonic: string, index?: number): GeneratedWallet;
89
+ /**
90
+ * Converts an Ethereum address to Gala backend format
91
+ *
92
+ * @param address Ethereum address (with or without 0x prefix)
93
+ * @returns Address in eth|{40-hex-chars} format
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * const galaAddr = WalletUtils.toGalaAddress('0x1234567890abcdef1234567890abcdef12345678');
98
+ * // Returns: 'eth|1234567890abcdef1234567890abcdef12345678'
99
+ * ```
100
+ */
101
+ static toGalaAddress(address: string): string;
102
+ /**
103
+ * Converts a Gala backend address to Ethereum format
104
+ *
105
+ * @param galaAddress Address in eth|{40-hex-chars} format
106
+ * @returns Ethereum address with 0x prefix
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * const ethAddr = WalletUtils.toEthereumAddress('eth|1234567890abcdef1234567890abcdef12345678');
111
+ * // Returns: '0x1234567890abcdef1234567890abcdef12345678'
112
+ * ```
113
+ */
114
+ static toEthereumAddress(galaAddress: string): string;
115
+ /**
116
+ * Validates an Ethereum address format
117
+ *
118
+ * @param address Address to validate
119
+ * @returns True if valid Ethereum address format
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * const isValid = WalletUtils.isValidEthereumAddress('0x1234...');
124
+ * ```
125
+ */
126
+ static isValidEthereumAddress(address: string): boolean;
127
+ /**
128
+ * Validates a Gala backend address format
129
+ *
130
+ * @param address Address to validate
131
+ * @returns True if valid Gala address format
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const isValid = WalletUtils.isValidGalaAddress('eth|1234...');
136
+ * ```
137
+ */
138
+ static isValidGalaAddress(address: string): boolean;
139
+ /**
140
+ * Generates multiple wallets at once
141
+ *
142
+ * Useful for testing, batch operations, or multi-user setups.
143
+ *
144
+ * @param count Number of wallets to generate (default: 1, max: 100)
145
+ * @returns Array of generated wallets
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * // Generate 5 test wallets
150
+ * const wallets = WalletUtils.generateMultipleWallets(5);
151
+ * wallets.forEach((wallet, index) => {
152
+ * console.log(`Wallet ${index + 1}: ${wallet.address}`);
153
+ * });
154
+ * ```
155
+ */
156
+ static generateMultipleWallets(count?: number): GeneratedWallet[];
157
+ /**
158
+ * Creates a summary of wallet information for display
159
+ *
160
+ * @param wallet Generated wallet to summarize
161
+ * @param includeSensitive Whether to include private key (default: false)
162
+ * @returns Formatted wallet summary
163
+ *
164
+ * @example
165
+ * ```typescript
166
+ * const wallet = WalletUtils.generateWallet();
167
+ * const summary = WalletUtils.getWalletSummary(wallet);
168
+ * console.log(summary);
169
+ * // Outputs formatted wallet information
170
+ * ```
171
+ */
172
+ static getWalletSummary(wallet: GeneratedWallet, includeSensitive?: boolean): string;
173
+ }
174
+ //# sourceMappingURL=wallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/utils/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA0B,MAAM,QAAQ,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,WAAW,CAAK;IAC/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,cAAc,IAAI,eAAe;IAsCxC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe;IAa1D;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,eAAe;IAmCzE;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAY7C;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAerD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAUvD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAYnD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,uBAAuB,CAAC,KAAK,GAAE,MAAU,GAAG,eAAe,EAAE;IAwBpE;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,gBAAgB,GAAE,OAAe,GAAG,MAAM;CAqB5F"}
package/package.json ADDED
@@ -0,0 +1,151 @@
1
+ {
2
+ "name": "@gala-chain/launchpad-sdk",
3
+ "version": "0.4.0",
4
+ "description": "TypeScript SDK for Gala Launchpad Backend API - Production-ready DeFi token launchpad integration with wallet-based authentication, GalaChain trading, and comprehensive user operations. 100% tested (22/22 endpoints working).",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist/**/*.js",
10
+ "dist/**/*.d.ts",
11
+ "dist/**/*.d.ts.map",
12
+ "!dist/**/*.test.*",
13
+ "!dist/**/tests/**",
14
+ "!dist/**/fixtures/**",
15
+ "README.md",
16
+ "API.md",
17
+ "EXAMPLES.md",
18
+ "TESTING.md",
19
+ "CHANGELOG.md",
20
+ "LICENSE"
21
+ ],
22
+ "exports": {
23
+ ".": {
24
+ "import": "./dist/index.esm.js",
25
+ "require": "./dist/index.js",
26
+ "types": "./dist/index.d.ts"
27
+ }
28
+ },
29
+ "scripts": {
30
+ "build": "npm run clean && npm run build:types && npm run build:bundle",
31
+ "build:types": "tsc --declaration --emitDeclarationOnly --outDir dist",
32
+ "build:bundle": "rollup -c rollup.config.mjs",
33
+ "build:watch": "rollup -c rollup.config.mjs --watch",
34
+ "clean": "rimraf dist coverage .nyc_output",
35
+ "test": "jest",
36
+ "test:watch": "jest --watch",
37
+ "test:coverage": "jest --coverage",
38
+ "test:ci": "jest --coverage --ci --watchAll=false",
39
+ "test:unit": "jest --selectProjects unit",
40
+ "test:integration": "jest --selectProjects integration",
41
+ "test:live": "tsx examples/trading/test-real-api-comprehensive.ts",
42
+ "test:live:help": "echo 'Live API Testing requires .env file with: WALLET_PRIVATE_KEY=your_test_wallet_private_key'",
43
+ "test:all": "npm run test:unit && npm run test:integration",
44
+ "test:trading": "tsx examples/trading/test-5-buys-5-sells.ts",
45
+ "test:websocket": "tsx examples/trading/test-websocket-monitoring.ts",
46
+ "demo": "tsx examples/demo-showcase.ts",
47
+ "lint": "eslint src --ext .ts,.tsx --fix",
48
+ "lint:check": "eslint src --ext .ts,.tsx",
49
+ "typecheck": "tsc --noEmit",
50
+ "typecheck:watch": "tsc --noEmit --watch",
51
+ "typecheck:examples": "tsc --project tsconfig.examples.json --noEmit",
52
+ "format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
53
+ "format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
54
+ "prepublishOnly": "npm run validate && npm run build",
55
+ "validate": "npm run lint:check && npm run typecheck && npm run test:ci",
56
+ "publish:beta": "npm run prepublishOnly && npm publish --tag beta",
57
+ "publish:stable": "npm run prepublishOnly && npm publish",
58
+ "version:patch": "npm version patch",
59
+ "version:minor": "npm version minor",
60
+ "version:major": "npm version major",
61
+ "changeset": "changeset",
62
+ "changeset:version": "changeset version",
63
+ "changeset:publish": "changeset publish",
64
+ "dev": "concurrently \"npm run build:watch\" \"npm run typecheck:watch\"",
65
+ "docs:clean": "rimraf docs/api docs/api-markdown docs/api-report temp",
66
+ "docs:prebuild": "npm run build:types",
67
+ "docs:extract": "api-extractor run --local --verbose",
68
+ "docs:extract:markdown": "api-documenter markdown -i temp -o docs/api-markdown",
69
+ "docs:typedoc": "typedoc --options typedoc-html.json",
70
+ "docs:typedoc:markdown": "typedoc --plugin typedoc-plugin-markdown --out docs/markdown",
71
+ "docs:ai": "tsx scripts/generate-ai-docs.ts",
72
+ "docs:agent": "tsx scripts/generate-agent-spec.ts",
73
+ "docs:validate": "tsx scripts/validate-examples.ts",
74
+ "docs:generate": "npm run docs:prebuild && npm run docs:extract && npm run docs:typedoc",
75
+ "docs:all": "npm run docs:clean && npm run docs:generate && npm run docs:extract:markdown && npm run docs:ai && npm run docs:agent",
76
+ "docs:serve": "http-server docs/api -p 8080",
77
+ "size": "size-limit",
78
+ "analyze": "rollup -c rollup.config.mjs --bundleAnalyzerReport"
79
+ },
80
+ "keywords": [
81
+ "gala",
82
+ "galachain",
83
+ "launchpad",
84
+ "defi",
85
+ "blockchain",
86
+ "ethereum",
87
+ "token",
88
+ "trading",
89
+ "sdk",
90
+ "typescript",
91
+ "api-client",
92
+ "crypto",
93
+ "web3",
94
+ "wallet",
95
+ "signature-auth",
96
+ "bonding-curve",
97
+ "token-creation",
98
+ "portfolio",
99
+ "comments"
100
+ ],
101
+ "author": {
102
+ "name": "Gala Launchpad Team",
103
+ "email": "dev@gala-launchpad.com",
104
+ "url": "https://gala-launchpad.com"
105
+ },
106
+ "license": "MIT",
107
+ "repository": {
108
+ "type": "git",
109
+ "url": "https://gitlab.com/gala-games/defi/launchpad/sdk.git"
110
+ },
111
+ "bugs": {
112
+ "url": "https://gitlab.com/gala-games/defi/launchpad/sdk/-/issues"
113
+ },
114
+ "homepage": "https://gitlab.com/gala-games/defi/launchpad/sdk#readme",
115
+ "engines": {
116
+ "node": ">=18.0.0",
117
+ "npm": ">=10.0.0"
118
+ },
119
+ "publishConfig": {
120
+ "access": "public",
121
+ "registry": "https://registry.npmjs.org/"
122
+ },
123
+ "browserslist": [
124
+ "> 1%",
125
+ "last 2 versions",
126
+ "not dead",
127
+ "not ie 11"
128
+ ],
129
+ "dependencies": {
130
+ "@gala-chain/api": "^1.10.10",
131
+ "@gala-chain/connect": "^2.4.3",
132
+ "@types/uuid": "^10.0.0",
133
+ "axios": "^1.12.2",
134
+ "bignumber.js": "^9.1.2",
135
+ "crypto-js": "^4.2.0",
136
+ "dotenv": "^17.2.2",
137
+ "ethers": "^6.15.0",
138
+ "socket.io-client": "^4.8.1",
139
+ "uuid": "^13.0.0"
140
+ },
141
+ "size-limit": [
142
+ {
143
+ "path": "./dist/index.js",
144
+ "limit": "50 kB"
145
+ },
146
+ {
147
+ "path": "./dist/index.esm.js",
148
+ "limit": "50 kB"
149
+ }
150
+ ]
151
+ }