@bounded-sh/server 0.0.20 → 0.0.23
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 +20 -41
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @bounded-sh/server
|
|
2
2
|
|
|
3
3
|
Server SDK for Tarobase API - Node.js/Backend implementation. This package provides functionality for server-side applications to interact with the Tarobase API using Solana keypairs for authentication.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @bounded-sh/server
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Or using yarn:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
yarn add @
|
|
14
|
+
yarn add @bounded-sh/server
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Features
|
|
@@ -26,15 +26,11 @@ yarn add @tarobase/server
|
|
|
26
26
|
## Basic Usage
|
|
27
27
|
|
|
28
28
|
```typescript
|
|
29
|
-
import { init, createWalletClient } from '@
|
|
29
|
+
import { init, createWalletClient } from '@bounded-sh/server';
|
|
30
30
|
|
|
31
31
|
async function main() {
|
|
32
32
|
// Initialize endpoints/app config only. Server signing identity is explicit.
|
|
33
|
-
await init({
|
|
34
|
-
apiKey: 'your-api-key',
|
|
35
|
-
appId: 'your-app-id',
|
|
36
|
-
authMethod: 'solana-keypair'
|
|
37
|
-
});
|
|
33
|
+
await init({ appId: 'your-app-id' });
|
|
38
34
|
|
|
39
35
|
// Create a wallet-scoped client from an explicit secret key.
|
|
40
36
|
const wallet = await createWalletClient({ keypair: process.env.SERVER_WALLET_KEYPAIR! });
|
|
@@ -60,59 +56,43 @@ main().catch(console.error);
|
|
|
60
56
|
### Loading a Keypair from a Secret Key File
|
|
61
57
|
|
|
62
58
|
```typescript
|
|
63
|
-
import { init, createWalletClient } from '@
|
|
59
|
+
import { init, createWalletClient } from '@bounded-sh/server';
|
|
64
60
|
import * as fs from 'fs';
|
|
65
61
|
|
|
66
62
|
// Load keypair from file
|
|
67
63
|
const secretKeyString = fs.readFileSync('/path/to/keypair.json', 'utf8');
|
|
68
64
|
|
|
69
65
|
// Initialize and create a wallet-scoped client
|
|
70
|
-
await init({
|
|
66
|
+
await init({ appId: 'your-app-id' });
|
|
71
67
|
const wallet = await createWalletClient({ keypair: secretKeyString });
|
|
72
68
|
```
|
|
73
69
|
|
|
74
|
-
###
|
|
70
|
+
### Signing And Transactions
|
|
75
71
|
|
|
76
72
|
```typescript
|
|
77
|
-
import { init,
|
|
78
|
-
import { Keypair } from '@solana/web3.js';
|
|
73
|
+
import { init, createWalletClient } from '@bounded-sh/server';
|
|
79
74
|
|
|
80
|
-
// Initialize the SDK
|
|
81
75
|
await init({
|
|
82
|
-
apiKey: 'your-api-key',
|
|
83
76
|
appId: 'your-app-id',
|
|
84
77
|
rpcUrl: process.env.SOLANA_MAINNET_RPC_URL
|
|
85
78
|
});
|
|
86
79
|
|
|
87
|
-
|
|
88
|
-
const provider = new SolanaKeypairProvider(
|
|
89
|
-
"https://your-solana-rpc.example",
|
|
90
|
-
Keypair.generate()
|
|
91
|
-
);
|
|
80
|
+
const wallet = await createWalletClient({ keypair: process.env.SERVER_WALLET_KEYPAIR! });
|
|
92
81
|
|
|
93
82
|
// Sign a message
|
|
94
|
-
const signature = await
|
|
83
|
+
const signature = await wallet.signMessage("Hello, world!");
|
|
95
84
|
|
|
96
|
-
//
|
|
97
|
-
const
|
|
98
|
-
appId: 'your-app-id',
|
|
99
|
-
network: 'solana_mainnet',
|
|
100
|
-
txArgs: [{
|
|
101
|
-
setDocumentData: [{ path: 'todos/123', data: { text: 'New todo' } }],
|
|
102
|
-
deletePaths: [],
|
|
103
|
-
remainingAccounts: [],
|
|
104
|
-
idl: {}
|
|
105
|
-
}]
|
|
106
|
-
});
|
|
85
|
+
// Submit a transaction you built explicitly with @solana/web3.js
|
|
86
|
+
// const signature = await wallet.signAndSubmitTransaction(transaction);
|
|
107
87
|
```
|
|
108
88
|
|
|
109
89
|
### Subscriptions
|
|
110
90
|
|
|
111
91
|
```typescript
|
|
112
|
-
import { init, createWalletClient } from '@
|
|
92
|
+
import { init, createWalletClient } from '@bounded-sh/server';
|
|
113
93
|
|
|
114
94
|
// Initialize and create an explicit wallet client
|
|
115
|
-
await init({
|
|
95
|
+
await init({ appId: 'your-app-id' });
|
|
116
96
|
const wallet = await createWalletClient({ keypair: process.env.SERVER_WALLET_KEYPAIR! });
|
|
117
97
|
|
|
118
98
|
// Subscribe to changes
|
|
@@ -186,8 +166,7 @@ networks fail closed.
|
|
|
186
166
|
|
|
187
167
|
```typescript
|
|
188
168
|
interface ClientConfig {
|
|
189
|
-
|
|
190
|
-
authMethod: 'solana-keypair' | string;
|
|
169
|
+
authMethod?: string;
|
|
191
170
|
wsApiUrl: string;
|
|
192
171
|
apiUrl: string;
|
|
193
172
|
appId: string;
|
|
@@ -239,10 +218,10 @@ This server-side SDK differs from the web SDK in several important ways:
|
|
|
239
218
|
4. **Session Management**: Does not rely on browser-specific APIs
|
|
240
219
|
5. **Dependencies**: Excludes browser-specific libraries
|
|
241
220
|
|
|
242
|
-
## Part of the
|
|
221
|
+
## Part of the Bounded SDK Family
|
|
243
222
|
|
|
244
223
|
This package is part of a family of modular SDKs:
|
|
245
224
|
|
|
246
|
-
- **@
|
|
247
|
-
- **@
|
|
248
|
-
- **@
|
|
225
|
+
- **@bounded-sh/core**: Core functionality shared between all SDKs
|
|
226
|
+
- **@bounded-sh/client**: Browser and React Native SDK
|
|
227
|
+
- **@bounded-sh/server**: Server-side SDK for backend applications
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bounded-sh/server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "Server SDK for Poof API - Node.js/Backend implementation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"typescript": "5.9.3"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@bounded-sh/core": "0.0.
|
|
49
|
+
"@bounded-sh/core": "0.0.23",
|
|
50
50
|
"@coral-xyz/anchor": "0.31.1",
|
|
51
51
|
"@solana/spl-token": "0.4.14",
|
|
52
52
|
"@solana/web3.js": "1.98.4",
|