@phantom/server-sdk 1.0.0-beta.20 → 1.0.0-beta.22
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 +63 -9
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -5
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -126,7 +126,7 @@ console.log("Ethereum address:", ethereumAddress);
|
|
|
126
126
|
The Server SDK provides two methods for handling transactions:
|
|
127
127
|
|
|
128
128
|
1. **`signTransaction(params)`** - Signs a transaction without submitting it to the network
|
|
129
|
-
- Returns the signed transaction
|
|
129
|
+
- Returns the signed transaction
|
|
130
130
|
- No network interaction
|
|
131
131
|
- Useful for offline signing or when you want to broadcast later
|
|
132
132
|
|
|
@@ -311,7 +311,7 @@ const customAddresses = await sdk.getWalletAddresses(
|
|
|
311
311
|
|
|
312
312
|
## Network Support
|
|
313
313
|
|
|
314
|
-
The SDK
|
|
314
|
+
The Server SDK uses the `NetworkId` enum to identify blockchain networks for signing transactions and messages.
|
|
315
315
|
|
|
316
316
|
### Solana Networks
|
|
317
317
|
|
|
@@ -322,21 +322,75 @@ The SDK supports multiple blockchain networks through the `NetworkId` enum:
|
|
|
322
322
|
### Ethereum Networks
|
|
323
323
|
|
|
324
324
|
- `NetworkId.ETHEREUM_MAINNET` - Ethereum Mainnet
|
|
325
|
-
- `NetworkId.ETHEREUM_GOERLI` - Goerli Testnet
|
|
326
325
|
- `NetworkId.ETHEREUM_SEPOLIA` - Sepolia Testnet
|
|
327
326
|
|
|
328
|
-
###
|
|
327
|
+
### Polygon Networks
|
|
329
328
|
|
|
330
|
-
- `NetworkId.POLYGON_MAINNET` - Polygon Mainnet
|
|
331
|
-
- `NetworkId.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
329
|
+
- `NetworkId.POLYGON_MAINNET` - Polygon Mainnet (Chain ID: 137)
|
|
330
|
+
- `NetworkId.POLYGON_AMOY` - Polygon Amoy Testnet (Chain ID: 80002)
|
|
331
|
+
|
|
332
|
+
### Base Networks
|
|
333
|
+
|
|
334
|
+
- `NetworkId.BASE_MAINNET` - Base Mainnet (Chain ID: 8453)
|
|
335
|
+
- `NetworkId.BASE_SEPOLIA` - Base Sepolia Testnet (Chain ID: 84532)
|
|
336
|
+
|
|
337
|
+
### Arbitrum Networks
|
|
338
|
+
|
|
339
|
+
- `NetworkId.ARBITRUM_ONE` - Arbitrum One (Chain ID: 42161)
|
|
340
|
+
- `NetworkId.ARBITRUM_SEPOLIA` - Arbitrum Sepolia Testnet (Chain ID: 421614)
|
|
341
|
+
|
|
342
|
+
### Monad Networks
|
|
343
|
+
|
|
344
|
+
- `NetworkId.MONAD_MAINNET` - Monad Mainnet (Chain ID: 143)
|
|
345
|
+
- `NetworkId.MONAD_TESTNET` - Monad Testnet (Chain ID: 10143)
|
|
335
346
|
|
|
336
347
|
### Future Support
|
|
337
348
|
|
|
338
349
|
- `NetworkId.BITCOIN_MAINNET` - Bitcoin Mainnet
|
|
350
|
+
- `NetworkId.BITCOIN_TESTNET` - Bitcoin Testnet
|
|
339
351
|
- `NetworkId.SUI_MAINNET` - Sui Mainnet
|
|
352
|
+
- `NetworkId.SUI_TESTNET` - Sui Testnet
|
|
353
|
+
- `NetworkId.SUI_DEVNET` - Sui Devnet
|
|
354
|
+
|
|
355
|
+
### Usage Examples
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
import { ServerSDK, NetworkId } from "@phantom/server-sdk";
|
|
359
|
+
|
|
360
|
+
const sdk = new ServerSDK({
|
|
361
|
+
organizationId: process.env.ORGANIZATION_ID!,
|
|
362
|
+
appId: process.env.APP_ID!,
|
|
363
|
+
apiPrivateKey: process.env.PRIVATE_KEY!,
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// Sign a message on Solana
|
|
367
|
+
await sdk.signMessage({
|
|
368
|
+
walletId: wallet.walletId,
|
|
369
|
+
message: "Hello from Phantom!",
|
|
370
|
+
networkId: NetworkId.SOLANA_MAINNET,
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
// Sign a transaction on Ethereum
|
|
374
|
+
await sdk.signAndSendTransaction({
|
|
375
|
+
walletId: wallet.walletId,
|
|
376
|
+
transaction: ethTransaction,
|
|
377
|
+
networkId: NetworkId.ETHEREUM_MAINNET,
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// Sign on Polygon
|
|
381
|
+
await sdk.signAndSendTransaction({
|
|
382
|
+
walletId: wallet.walletId,
|
|
383
|
+
transaction: polygonTransaction,
|
|
384
|
+
networkId: NetworkId.POLYGON_MAINNET,
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
// Sign on Base
|
|
388
|
+
await sdk.signAndSendTransaction({
|
|
389
|
+
walletId: wallet.walletId,
|
|
390
|
+
transaction: baseTransaction,
|
|
391
|
+
networkId: NetworkId.BASE_MAINNET,
|
|
392
|
+
});
|
|
393
|
+
```
|
|
340
394
|
|
|
341
395
|
## API Reference
|
|
342
396
|
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,7 @@ var import_bs58 = __toESM(require("bs58"));
|
|
|
58
58
|
// package.json
|
|
59
59
|
var package_default = {
|
|
60
60
|
name: "@phantom/server-sdk",
|
|
61
|
-
version: "1.0.0-beta.
|
|
61
|
+
version: "1.0.0-beta.22",
|
|
62
62
|
description: "Server SDK for Phantom Wallet",
|
|
63
63
|
main: "dist/index.js",
|
|
64
64
|
module: "dist/index.mjs",
|
package/dist/index.mjs
CHANGED
|
@@ -3,10 +3,7 @@ import {
|
|
|
3
3
|
PhantomClient
|
|
4
4
|
} from "@phantom/client";
|
|
5
5
|
import { randomUUID, getSecureTimestampSync, isEthereumChain } from "@phantom/utils";
|
|
6
|
-
import {
|
|
7
|
-
ANALYTICS_HEADERS,
|
|
8
|
-
DEFAULT_WALLET_API_URL
|
|
9
|
-
} from "@phantom/constants";
|
|
6
|
+
import { ANALYTICS_HEADERS, DEFAULT_WALLET_API_URL } from "@phantom/constants";
|
|
10
7
|
import { ApiKeyStamper } from "@phantom/api-key-stamper";
|
|
11
8
|
import { base64urlEncode, stringToBase64url } from "@phantom/base64url";
|
|
12
9
|
import bs58 from "bs58";
|
|
@@ -14,7 +11,7 @@ import bs58 from "bs58";
|
|
|
14
11
|
// package.json
|
|
15
12
|
var package_default = {
|
|
16
13
|
name: "@phantom/server-sdk",
|
|
17
|
-
version: "1.0.0-beta.
|
|
14
|
+
version: "1.0.0-beta.22",
|
|
18
15
|
description: "Server SDK for Phantom Wallet",
|
|
19
16
|
main: "dist/index.js",
|
|
20
17
|
module: "dist/index.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantom/server-sdk",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.22",
|
|
4
4
|
"description": "Server SDK for Phantom Wallet",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"typescript": "^5.0.4"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@phantom/api-key-stamper": "^1.0.0-beta.
|
|
41
|
-
"@phantom/base64url": "^1.0.0-beta.
|
|
42
|
-
"@phantom/client": "^1.0.0-beta.
|
|
43
|
-
"@phantom/constants": "^1.0.0-beta.
|
|
44
|
-
"@phantom/parsers": "^1.0.0-beta.
|
|
45
|
-
"@phantom/utils": "^1.0.0-beta.
|
|
40
|
+
"@phantom/api-key-stamper": "^1.0.0-beta.10",
|
|
41
|
+
"@phantom/base64url": "^1.0.0-beta.10",
|
|
42
|
+
"@phantom/client": "^1.0.0-beta.22",
|
|
43
|
+
"@phantom/constants": "^1.0.0-beta.10",
|
|
44
|
+
"@phantom/parsers": "^1.0.0-beta.10",
|
|
45
|
+
"@phantom/utils": "^1.0.0-beta.22",
|
|
46
46
|
"bs58": "^6.0.0"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|