@gala-chain/launchpad-sdk 4.0.15-beta.0 → 4.0.15-beta.1
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 +49 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/LaunchpadSDK.d.ts +25 -0
- package/dist/src/LaunchpadSDK.d.ts.map +1 -1
- package/dist/src/constants/version.generated.d.ts +1 -1
- package/dist/src/helpers/wallet.d.ts +51 -0
- package/dist/src/helpers/wallet.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/utils/agent-config.d.ts +7 -0
- package/dist/src/utils/agent-config.d.ts.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2522,6 +2522,55 @@ const randomWallet = createWallet(); // Generate random wallet
|
|
|
2522
2522
|
const isValid = validateWalletInput('0x1234...'); // boolean
|
|
2523
2523
|
```
|
|
2524
2524
|
|
|
2525
|
+
### **Key Derivation**
|
|
2526
|
+
|
|
2527
|
+
Derive public keys and addresses from private keys without creating a wallet:
|
|
2528
|
+
|
|
2529
|
+
```typescript
|
|
2530
|
+
import {
|
|
2531
|
+
getPublicKeyFromPrivateKey,
|
|
2532
|
+
getEthereumAddressFromPrivateKey
|
|
2533
|
+
} from '@gala-chain/launchpad-sdk';
|
|
2534
|
+
|
|
2535
|
+
// Get public key (both compressed and uncompressed formats)
|
|
2536
|
+
const { publicKey, compressedPublicKey } = getPublicKeyFromPrivateKey('0x...');
|
|
2537
|
+
// publicKey: "0x04..." (132 chars, uncompressed)
|
|
2538
|
+
// compressedPublicKey: "0x02..." or "0x03..." (68 chars)
|
|
2539
|
+
|
|
2540
|
+
// Get Ethereum address from private key
|
|
2541
|
+
const address = getEthereumAddressFromPrivateKey('0x...');
|
|
2542
|
+
// "0x8Ba1f109551bD432803012645Ac136ddd64DBA72" (checksum format)
|
|
2543
|
+
|
|
2544
|
+
// Convert to GalaChain format manually
|
|
2545
|
+
const galaChainAddress = `eth|${address.slice(2).toLowerCase()}`;
|
|
2546
|
+
// "eth|8ba1f109551bd432803012645ac136ddd64dba72"
|
|
2547
|
+
```
|
|
2548
|
+
|
|
2549
|
+
### **GalaChain Address Override**
|
|
2550
|
+
|
|
2551
|
+
For non-standard GalaChain addresses (like `client|ops-admin`), use the `galaChainAddress` config option:
|
|
2552
|
+
|
|
2553
|
+
```typescript
|
|
2554
|
+
import { LaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
2555
|
+
|
|
2556
|
+
// Standard: address derived from wallet
|
|
2557
|
+
const sdk = new LaunchpadSDK({ wallet });
|
|
2558
|
+
sdk.getAddress(); // "eth|a1b2c3d4..."
|
|
2559
|
+
|
|
2560
|
+
// Override: use custom GalaChain address
|
|
2561
|
+
const adminSdk = new LaunchpadSDK({
|
|
2562
|
+
wallet,
|
|
2563
|
+
galaChainAddress: 'client|ops-admin'
|
|
2564
|
+
});
|
|
2565
|
+
adminSdk.getAddress(); // "client|ops-admin"
|
|
2566
|
+
```
|
|
2567
|
+
|
|
2568
|
+
Or via environment variable for MCP/Agent setups:
|
|
2569
|
+
```bash
|
|
2570
|
+
export WALLET_PRIVATE_KEY=0x...
|
|
2571
|
+
export WALLET_ADDRESS=client|ops-admin # Override
|
|
2572
|
+
```
|
|
2573
|
+
|
|
2525
2574
|
### **SDK Factory Functions**
|
|
2526
2575
|
```typescript
|
|
2527
2576
|
import { createLaunchpadSDK, createTestLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|