@iqlabs-official/solana-sdk 0.1.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 +421 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +4 -0
- package/dist/contract/constants.d.ts +17 -0
- package/dist/contract/constants.js +20 -0
- package/dist/contract/discriminators.d.ts +2 -0
- package/dist/contract/discriminators.js +4 -0
- package/dist/contract/index.d.ts +5 -0
- package/dist/contract/index.js +21 -0
- package/dist/contract/instructions.d.ts +246 -0
- package/dist/contract/instructions.js +129 -0
- package/dist/contract/pda.d.ts +16 -0
- package/dist/contract/pda.js +104 -0
- package/dist/contract/profile.d.ts +3 -0
- package/dist/contract/profile.js +14 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +63 -0
- package/dist/sdk/constants.d.ts +5 -0
- package/dist/sdk/constants.js +8 -0
- package/dist/sdk/reader/index.d.ts +5 -0
- package/dist/sdk/reader/index.js +19 -0
- package/dist/sdk/reader/iqdb.d.ts +19 -0
- package/dist/sdk/reader/iqdb.js +166 -0
- package/dist/sdk/reader/read_code_in.d.ts +4 -0
- package/dist/sdk/reader/read_code_in.js +19 -0
- package/dist/sdk/reader/reader_context.d.ts +11 -0
- package/dist/sdk/reader/reader_context.js +50 -0
- package/dist/sdk/reader/reader_profile.d.ts +6 -0
- package/dist/sdk/reader/reader_profile.js +67 -0
- package/dist/sdk/reader/reader_utils.d.ts +34 -0
- package/dist/sdk/reader/reader_utils.js +238 -0
- package/dist/sdk/reader/reading_flow.d.ts +26 -0
- package/dist/sdk/reader/reading_flow.js +169 -0
- package/dist/sdk/reader/reading_methods.d.ts +10 -0
- package/dist/sdk/reader/reading_methods.js +233 -0
- package/dist/sdk/utils/ata.d.ts +3 -0
- package/dist/sdk/utils/ata.js +24 -0
- package/dist/sdk/utils/concurrency.d.ts +1 -0
- package/dist/sdk/utils/concurrency.js +22 -0
- package/dist/sdk/utils/connection_helper.d.ts +13 -0
- package/dist/sdk/utils/connection_helper.js +78 -0
- package/dist/sdk/utils/global_fetch.d.ts +52 -0
- package/dist/sdk/utils/global_fetch.js +125 -0
- package/dist/sdk/utils/index.d.ts +1 -0
- package/dist/sdk/utils/index.js +6 -0
- package/dist/sdk/utils/rate_limiter.d.ts +3 -0
- package/dist/sdk/utils/rate_limiter.js +22 -0
- package/dist/sdk/utils/seed.d.ts +4 -0
- package/dist/sdk/utils/seed.js +24 -0
- package/dist/sdk/utils/session_speed.d.ts +21 -0
- package/dist/sdk/utils/session_speed.js +18 -0
- package/dist/sdk/utils/wallet.d.ts +8 -0
- package/dist/sdk/utils/wallet.js +36 -0
- package/dist/sdk/writer/code_in.d.ts +24 -0
- package/dist/sdk/writer/code_in.js +124 -0
- package/dist/sdk/writer/index.d.ts +2 -0
- package/dist/sdk/writer/index.js +11 -0
- package/dist/sdk/writer/iqdb.d.ts +7 -0
- package/dist/sdk/writer/iqdb.js +256 -0
- package/dist/sdk/writer/uploading_methods.d.ts +10 -0
- package/dist/sdk/writer/uploading_methods.js +101 -0
- package/dist/sdk/writer/writer_utils.d.ts +17 -0
- package/dist/sdk/writer/writer_utils.js +145 -0
- package/idl/code_in.json +4983 -0
- package/package.json +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
# IQLabs SDK
|
|
2
|
+
|
|
3
|
+
> **Draft**: This document is in progress and will be refined.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
1. [Core Concepts](#core-concepts)
|
|
10
|
+
- [Data Storage (Code In)](#data-storage-code-in)
|
|
11
|
+
- [User State PDA](#user-state-pda)
|
|
12
|
+
- [Connection PDA](#connection-pda)
|
|
13
|
+
- [Database Tables](#database-tables)
|
|
14
|
+
|
|
15
|
+
2. [Function Details](#function-details)
|
|
16
|
+
- [Data Storage and Retrieval](#data-storage-and-retrieval)
|
|
17
|
+
- [Connection Management](#connection-management)
|
|
18
|
+
- [Table Management](#table-management)
|
|
19
|
+
- [Environment Settings](#environment-settings)
|
|
20
|
+
|
|
21
|
+
2.1. [Advanced Functions](#advanced-functions) (list only)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Core Concepts
|
|
26
|
+
|
|
27
|
+
These are the key concepts to know before using the IQLabs SDK.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### Data Storage (Code In)
|
|
32
|
+
|
|
33
|
+
This is how you store any data (files, text, JSON) on-chain.
|
|
34
|
+
|
|
35
|
+
#### How is it stored?
|
|
36
|
+
|
|
37
|
+
Depending on data size, the SDK picks the optimal method:
|
|
38
|
+
|
|
39
|
+
- **Small data (< 900 bytes)**: store immediately, fastest
|
|
40
|
+
- **Medium data (< 8.5 KB)**: split into multiple transactions
|
|
41
|
+
- **Large data (>= 8.5 KB)**: upload in parallel for speed
|
|
42
|
+
|
|
43
|
+
#### Key related functions
|
|
44
|
+
|
|
45
|
+
- [`codeIn()`](#codein): upload data and get a transaction ID
|
|
46
|
+
- [`readCodeIn()`](#readcodein): read data back from a transaction ID
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
### User State PDA
|
|
51
|
+
|
|
52
|
+
An on-chain profile account for a user.
|
|
53
|
+
|
|
54
|
+
#### What gets stored?
|
|
55
|
+
|
|
56
|
+
- Profile info (name, profile picture, bio, etc.)
|
|
57
|
+
- Number of uploaded files
|
|
58
|
+
- Friend request records
|
|
59
|
+
|
|
60
|
+
> **Note**: Friend requests are not stored as values in the PDA; they are sent as transactions.
|
|
61
|
+
|
|
62
|
+
#### When is it created?
|
|
63
|
+
|
|
64
|
+
It is created automatically the first time you call [`codeIn()`](#codein). No extra setup is required, but the first user may need to sign twice.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### Connection PDA
|
|
69
|
+
|
|
70
|
+
An on-chain account that manages relationships between two users (friends, messages, etc.).
|
|
71
|
+
|
|
72
|
+
#### What states can it have?
|
|
73
|
+
|
|
74
|
+
- **pending**: a friend request was sent but not accepted yet
|
|
75
|
+
- **approved**: the request was accepted and the users are connected
|
|
76
|
+
- **blocked**: one side blocked the other
|
|
77
|
+
|
|
78
|
+
> **Important**: A blocked connection can only be unblocked by the blocker.
|
|
79
|
+
|
|
80
|
+
#### Key related functions
|
|
81
|
+
|
|
82
|
+
- [`requestConnection()`](#requestconnection): send a friend request (creates pending)
|
|
83
|
+
- [`manageConnection()`](#manageconnection): approve/reject/block/unblock a request
|
|
84
|
+
- [`readConnection()`](#readconnection): check current relationship status
|
|
85
|
+
- [`writeConnectionRow()`](#writeconnectionrow): exchange messages/data with a connected friend
|
|
86
|
+
- [`fetchUserConnections()`](#fetchuserconnections): fetch all connections (sent & received friend requests)
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Database Tables
|
|
91
|
+
|
|
92
|
+
Store JSON data in tables like a database.
|
|
93
|
+
|
|
94
|
+
#### How are tables created?
|
|
95
|
+
|
|
96
|
+
There is no dedicated "create table" function. The first write via [`writeRow()`](#writerow) creates the table automatically.
|
|
97
|
+
|
|
98
|
+
> **Note**: A table is uniquely identified by the combination of `dbRootId` and `tableSeed` (table name).
|
|
99
|
+
|
|
100
|
+
#### Key related functions
|
|
101
|
+
|
|
102
|
+
- [`writeRow()`](#writerow): add a new row (creates the table if missing)
|
|
103
|
+
- [`readTableRows()`](#readtablerows): read rows from a table
|
|
104
|
+
- [`getTablelistFromRoot()`](#gettablelistfromroot): list all tables in a database
|
|
105
|
+
- [`fetchInventoryTransactions()`](#fetchinventorytransactions): list uploaded files
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Function Details
|
|
110
|
+
|
|
111
|
+
### Data Storage and Retrieval
|
|
112
|
+
|
|
113
|
+
#### `codeIn()`
|
|
114
|
+
|
|
115
|
+
| **Parameters** | `input`: `{ connection, signer }` object<br>`data`: string or string array (auto-chunks large data)<br>`mode`: contract mode (optional)<br>`filename`: optional filename<br>`method`: upload method (optional)<br>`filetype`: MIME type (optional)<br>`onProgress`: progress callback (optional) |
|
|
116
|
+
|----------|--------------------------|
|
|
117
|
+
| **Returns** | Transaction signature (string) |
|
|
118
|
+
|
|
119
|
+
**Example:**
|
|
120
|
+
```typescript
|
|
121
|
+
import iqlabs from 'iqlabs-sdk';
|
|
122
|
+
|
|
123
|
+
const signature = await iqlabs.writer.codeIn({ connection, signer }, 'Hello, blockchain!');
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
#### `readCodeIn()`
|
|
129
|
+
|
|
130
|
+
| **Parameters** | `txSignature`: transaction signature<br>`speed`: rate limit profile (optional): 'light' \| 'medium' \| 'heavy' \| 'extreme'<br>`onProgress`: progress callback (optional) |
|
|
131
|
+
|----------|--------------------------|
|
|
132
|
+
| **Returns** | `{ metadata: string, data: string \| null }` |
|
|
133
|
+
|
|
134
|
+
**Example:**
|
|
135
|
+
```typescript
|
|
136
|
+
import iqlabs from 'iqlabs-sdk';
|
|
137
|
+
|
|
138
|
+
iqlabs.setRpcUrl('https://api.devnet.solana.com');
|
|
139
|
+
|
|
140
|
+
const { metadata, data } = await iqlabs.reader.readCodeIn('5Xg7...');
|
|
141
|
+
console.log(data); // 'Hello, blockchain!'
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### Connection Management
|
|
147
|
+
|
|
148
|
+
#### `requestConnection()`
|
|
149
|
+
|
|
150
|
+
| **Parameters** | `connection`: Solana RPC connection<br>`signer`: signing wallet<br>`dbRootId`: database ID<br>`partyA`, `partyB`: the two users to connect<br>`tableName`: connection table name<br>`columns`: column list<br>`idCol`: ID column<br>`extKeys`: extension keys |
|
|
151
|
+
|----------|--------------------------|
|
|
152
|
+
| **Returns** | Transaction signature (string) |
|
|
153
|
+
|
|
154
|
+
**Example:**
|
|
155
|
+
```typescript
|
|
156
|
+
import iqlabs from 'iqlabs-sdk';
|
|
157
|
+
|
|
158
|
+
await iqlabs.writer.requestConnection(
|
|
159
|
+
connection, signer, 'my-db',
|
|
160
|
+
myWalletAddress, friendWalletAddress,
|
|
161
|
+
'dm_table', ['message', 'timestamp'], 'message_id', []
|
|
162
|
+
);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
#### `manageConnection()`
|
|
168
|
+
|
|
169
|
+
| **Parameters** | `builder`: InstructionBuilder<br>`accounts`: `{ db_root, connection_table, signer }`<br>`args`: `{ db_root_id, connection_seed, new_status }` |
|
|
170
|
+
|----------|--------------------------|
|
|
171
|
+
| **Returns** | TransactionInstruction |
|
|
172
|
+
|
|
173
|
+
**Example:**
|
|
174
|
+
```typescript
|
|
175
|
+
import iqlabs from 'iqlabs-sdk';
|
|
176
|
+
|
|
177
|
+
// Approve a friend request
|
|
178
|
+
const approveIx = iqlabs.contract.manageConnectionInstruction(
|
|
179
|
+
builder,
|
|
180
|
+
{ db_root, connection_table, signer: myPubkey },
|
|
181
|
+
{ db_root_id, connection_seed, new_status: iqlabs.contract.CONNECTION_STATUS_APPROVED }
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
// Block a user
|
|
185
|
+
const blockIx = iqlabs.contract.manageConnectionInstruction(
|
|
186
|
+
builder,
|
|
187
|
+
{ db_root, connection_table, signer: myPubkey },
|
|
188
|
+
{ db_root_id, connection_seed, new_status: iqlabs.contract.CONNECTION_STATUS_BLOCKED }
|
|
189
|
+
);
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
#### `readConnection()`
|
|
195
|
+
|
|
196
|
+
| **Parameters** | `dbRootId`: database ID<br>`walletA`, `walletB`: the two wallets to check |
|
|
197
|
+
|----------|--------------------------|
|
|
198
|
+
| **Returns** | `{ status: 'pending' | 'approved' | 'blocked', requester, blocker }` |
|
|
199
|
+
|
|
200
|
+
**Example:**
|
|
201
|
+
```typescript
|
|
202
|
+
import iqlabs from 'iqlabs-sdk';
|
|
203
|
+
|
|
204
|
+
const { status, requester, blocker } = await iqlabs.reader.readConnection('my-db', walletA, walletB);
|
|
205
|
+
console.log(status); // 'pending' | 'approved' | 'blocked'
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
#### `writeConnectionRow()`
|
|
211
|
+
|
|
212
|
+
| **Parameters** | `connection`: Solana RPC connection<br>`signer`: signing wallet<br>`dbRootId`: database ID<br>`connectionSeed`: connection seed<br>`rowJson`: JSON data |
|
|
213
|
+
|----------|--------------------------|
|
|
214
|
+
| **Returns** | Transaction signature (string) |
|
|
215
|
+
|
|
216
|
+
**Example:**
|
|
217
|
+
```typescript
|
|
218
|
+
import iqlabs from 'iqlabs-sdk';
|
|
219
|
+
|
|
220
|
+
await iqlabs.writer.writeConnectionRow(
|
|
221
|
+
connection, signer, 'my-db', connectionSeed,
|
|
222
|
+
JSON.stringify({ message_id: '123', message: 'Hello friend!', timestamp: Date.now() })
|
|
223
|
+
);
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
#### `fetchUserConnections()`
|
|
229
|
+
|
|
230
|
+
Fetch all connections (friend requests) for a user by analyzing their UserState PDA transaction history. Each connection includes its `dbRootId`, identifying which app the connection belongs to.
|
|
231
|
+
|
|
232
|
+
| **Parameters** | `userPubkey`: user public key (string or PublicKey)<br>`options`: optional settings |
|
|
233
|
+
|----------|--------------------------|
|
|
234
|
+
| **Options** | `limit`: max number of transactions to fetch<br>`before`: signature to paginate from<br>`speed`: rate limit profile ('light', 'medium', 'heavy', 'extreme')<br>`mode`: contract mode (optional) |
|
|
235
|
+
| **Returns** | Array of connection objects with dbRootId, partyA, partyB, status, requester, blocker, timestamp |
|
|
236
|
+
|
|
237
|
+
**Example:**
|
|
238
|
+
```typescript
|
|
239
|
+
import iqlabs from 'iqlabs-sdk';
|
|
240
|
+
|
|
241
|
+
// Fetch all connections (across all apps!)
|
|
242
|
+
const connections = await iqlabs.reader.fetchUserConnections(myPubkey, {
|
|
243
|
+
speed: 'light', // 6 RPS (default)
|
|
244
|
+
limit: 100
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// Filter by app
|
|
248
|
+
const solchatConnections = connections.filter(c => c.dbRootId === 'solchat');
|
|
249
|
+
const zoConnections = connections.filter(c => c.dbRootId === 'zo-trading');
|
|
250
|
+
|
|
251
|
+
// Filter by status
|
|
252
|
+
const pendingRequests = connections.filter(c => c.status === 'pending');
|
|
253
|
+
const friends = connections.filter(c => c.status === 'approved');
|
|
254
|
+
const blocked = connections.filter(c => c.status === 'blocked');
|
|
255
|
+
|
|
256
|
+
// Check connection details
|
|
257
|
+
connections.forEach(conn => {
|
|
258
|
+
console.log(`App: ${conn.dbRootId}, ${conn.partyA} ↔ ${conn.partyB}, status: ${conn.status}`);
|
|
259
|
+
});
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
### Table Management
|
|
265
|
+
|
|
266
|
+
#### `writeRow()`
|
|
267
|
+
|
|
268
|
+
| **Parameters** | `connection`: Solana RPC connection<br>`signer`: signing wallet<br>`dbRootId`: database ID<br>`tableSeed`: table name<br>`rowJson`: JSON row data |
|
|
269
|
+
|----------|--------------------------|
|
|
270
|
+
| **Returns** | Transaction signature (string) |
|
|
271
|
+
|
|
272
|
+
**Example:**
|
|
273
|
+
```typescript
|
|
274
|
+
import iqlabs from 'iqlabs-sdk';
|
|
275
|
+
|
|
276
|
+
// Write the first row to create the table
|
|
277
|
+
await iqlabs.writer.writeRow(connection, signer, 'my-db', 'users', JSON.stringify({
|
|
278
|
+
id: 1, name: 'Alice', email: 'alice@example.com'
|
|
279
|
+
}));
|
|
280
|
+
|
|
281
|
+
// Add another row to the same table
|
|
282
|
+
await iqlabs.writer.writeRow(connection, signer, 'my-db', 'users', JSON.stringify({
|
|
283
|
+
id: 2, name: 'Bob', email: 'bob@example.com'
|
|
284
|
+
}));
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
#### `readTableRows()`
|
|
290
|
+
|
|
291
|
+
| **Parameters** | `account`: table PDA (PublicKey or string)<br>`options`: optional settings |
|
|
292
|
+
|----------|--------------------------|
|
|
293
|
+
| **Options** | `limit`: max number of rows to fetch<br>`before`: signature cursor for pagination<br>`signatures`: pre-collected signature array (skips RPC fetch if provided)<br>`speed`: rate limit profile ('light', 'medium', 'heavy', 'extreme') |
|
|
294
|
+
| **Returns** | `Array<Record<string, unknown>>` |
|
|
295
|
+
|
|
296
|
+
**Example:**
|
|
297
|
+
```typescript
|
|
298
|
+
import iqlabs from 'iqlabs-sdk';
|
|
299
|
+
|
|
300
|
+
// Basic usage
|
|
301
|
+
const rows = await iqlabs.reader.readTableRows(tablePda, { limit: 50 });
|
|
302
|
+
|
|
303
|
+
// Cursor-based pagination
|
|
304
|
+
const olderRows = await iqlabs.reader.readTableRows(tablePda, { limit: 50, before: 'sig...' });
|
|
305
|
+
|
|
306
|
+
// With pre-collected signatures (skips signature fetching, decodes directly)
|
|
307
|
+
const sigs = await iqlabs.reader.collectSignatures(tablePda);
|
|
308
|
+
const targetIdx = sigs.indexOf('abc123');
|
|
309
|
+
const slice = sigs.slice(targetIdx - 25, targetIdx + 25);
|
|
310
|
+
const rows = await iqlabs.reader.readTableRows(tablePda, { signatures: slice });
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
#### `collectSignatures()`
|
|
316
|
+
|
|
317
|
+
Collects all (or up to `maxSignatures`) transaction signatures for an account. Lightweight — no transaction decoding, only signature strings. Useful for pagination: fetch the full signature list once, then slice and pass to `readTableRows()`.
|
|
318
|
+
|
|
319
|
+
| **Parameters** | `account`: table PDA (PublicKey or string)<br>`maxSignatures`: max number of signatures to collect (optional, fetches all if omitted) |
|
|
320
|
+
|----------|--------------------------|
|
|
321
|
+
| **Returns** | `string[]` (signature strings) |
|
|
322
|
+
|
|
323
|
+
**Example:**
|
|
324
|
+
```typescript
|
|
325
|
+
import iqlabs from 'iqlabs-sdk';
|
|
326
|
+
|
|
327
|
+
// Collect all signatures
|
|
328
|
+
const allSigs = await iqlabs.reader.collectSignatures(tablePda);
|
|
329
|
+
|
|
330
|
+
// Collect up to 3000 signatures
|
|
331
|
+
const sigs = await iqlabs.reader.collectSignatures(tablePda, 3000);
|
|
332
|
+
|
|
333
|
+
// Use with readTableRows to read from the middle
|
|
334
|
+
const targetIdx = sigs.indexOf('abc123');
|
|
335
|
+
const chunk = sigs.slice(targetIdx - 25, targetIdx + 25);
|
|
336
|
+
const rows = await iqlabs.reader.readTableRows(tablePda, { signatures: chunk });
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
#### `getTablelistFromRoot()`
|
|
342
|
+
|
|
343
|
+
| **Parameters** | `dbRootId`: database ID |
|
|
344
|
+
|----------|--------------------------|
|
|
345
|
+
| **Returns** | Table name array (string[]) |
|
|
346
|
+
|
|
347
|
+
**Example:**
|
|
348
|
+
```typescript
|
|
349
|
+
import iqlabs from 'iqlabs-sdk';
|
|
350
|
+
|
|
351
|
+
const tables = await iqlabs.reader.getTablelistFromRoot('my-db');
|
|
352
|
+
console.log('Table list:', tables);
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
#### `fetchInventoryTransactions()`
|
|
358
|
+
|
|
359
|
+
| **Parameters** | `userPubkey`: user public key<br>`limit`: max count (optional) |
|
|
360
|
+
|----------|--------------------------|
|
|
361
|
+
| **Returns** | Transaction array |
|
|
362
|
+
|
|
363
|
+
**Example:**
|
|
364
|
+
```typescript
|
|
365
|
+
import iqlabs from 'iqlabs-sdk';
|
|
366
|
+
|
|
367
|
+
const myFiles = await iqlabs.reader.fetchInventoryTransactions(myPubkey, 20);
|
|
368
|
+
myFiles.forEach(tx => {
|
|
369
|
+
let metadata: { data?: unknown } | null = null;
|
|
370
|
+
try {
|
|
371
|
+
metadata = JSON.parse(tx.metadata);
|
|
372
|
+
} catch {
|
|
373
|
+
metadata = null;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (metadata && metadata.data !== undefined) {
|
|
377
|
+
const inlineData = typeof metadata.data === 'string'
|
|
378
|
+
? metadata.data
|
|
379
|
+
: JSON.stringify(metadata.data);
|
|
380
|
+
console.log(`Inline data: ${inlineData}`);
|
|
381
|
+
} else {
|
|
382
|
+
console.log(`Signature: ${tx.signature}`);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
### Environment Settings
|
|
390
|
+
|
|
391
|
+
#### `setRpcUrl()`
|
|
392
|
+
|
|
393
|
+
| **Parameters** | `url`: Solana RPC URL |
|
|
394
|
+
|----------|--------------------------|
|
|
395
|
+
| **Returns** | None (void) |
|
|
396
|
+
|
|
397
|
+
**Example:**
|
|
398
|
+
```typescript
|
|
399
|
+
import iqlabs from 'iqlabs-sdk';
|
|
400
|
+
|
|
401
|
+
iqlabs.setRpcUrl('https://your-rpc.example.com');
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
## Advanced Functions
|
|
407
|
+
|
|
408
|
+
These functions are advanced/internal, so this doc lists them only. If you are looking for any of the following functions, please see our API docs (in progress).
|
|
409
|
+
|
|
410
|
+
- `manageRowData()` (`writer`)
|
|
411
|
+
- `readUserState()` (`reader`)
|
|
412
|
+
- `readInventoryMetadata()` (`reader`)
|
|
413
|
+
- `getSessionPdaList()` (`reader`)
|
|
414
|
+
- `deriveDmSeed()` (`utils`/`reader`)
|
|
415
|
+
- `toSeedBytes()` (`utils`)
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Additional Resources
|
|
420
|
+
- [IQLabs Official X](https://x.com/IQLabsOfficial)
|
|
421
|
+
- [IQ Gateway](https://github.com/IQCoreTeam/iq-gateway)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_CONTRACT_MODE = "anchor";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const DEFAULT_ANCHOR_PROGRAM_ID = "9KLLchQVJpGkw4jPuUmnvqESdR7mtNCYr3qS4iQLabs";
|
|
2
|
+
export declare const DEFAULT_PINOCCHIO_PROGRAM_ID = "9KLLchQVJpGkw4jPuUmnvqESdR7mtNCYr3qS4iQLabs";
|
|
3
|
+
export declare const SEED_CONFIG = "configmY}AGBJiqLabs";
|
|
4
|
+
export declare const SEED_DB_ROOT = "rootmY}AGBJiqLabs";
|
|
5
|
+
export declare const SEED_TABLE = "tablemY}AGBJiqLabs";
|
|
6
|
+
export declare const SEED_TABLE_REF = "table-refmY}AGBJiqLabs";
|
|
7
|
+
export declare const SEED_INSTRUCTION = "instructionmY}AGBJiqLabs";
|
|
8
|
+
export declare const SEED_TARGET = "targetmY}AGBJiqLabs";
|
|
9
|
+
export declare const SEED_USER = "usermY}AGBJiqLabs";
|
|
10
|
+
export declare const SEED_BUNDLE = "bundlemY}AGBJiqLabs";
|
|
11
|
+
export declare const SEED_CONNECTION = "connectionmY}AGAJiqLabs";
|
|
12
|
+
export declare const SEED_CODE_ACCOUNT = "codemY}AGBJiqLabs";
|
|
13
|
+
export declare const SEED_USER_INVENTORY = "inventorymY}AGBJiqLabs";
|
|
14
|
+
export declare const CONNECTION_STATUS_PENDING = 0;
|
|
15
|
+
export declare const CONNECTION_STATUS_APPROVED = 1;
|
|
16
|
+
export declare const CONNECTION_STATUS_BLOCKED = 2;
|
|
17
|
+
export declare const CONNECTION_BLOCKER_NONE = 255;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONNECTION_BLOCKER_NONE = exports.CONNECTION_STATUS_BLOCKED = exports.CONNECTION_STATUS_APPROVED = exports.CONNECTION_STATUS_PENDING = exports.SEED_USER_INVENTORY = exports.SEED_CODE_ACCOUNT = exports.SEED_CONNECTION = exports.SEED_BUNDLE = exports.SEED_USER = exports.SEED_TARGET = exports.SEED_INSTRUCTION = exports.SEED_TABLE_REF = exports.SEED_TABLE = exports.SEED_DB_ROOT = exports.SEED_CONFIG = exports.DEFAULT_PINOCCHIO_PROGRAM_ID = exports.DEFAULT_ANCHOR_PROGRAM_ID = void 0;
|
|
4
|
+
exports.DEFAULT_ANCHOR_PROGRAM_ID = "9KLLchQVJpGkw4jPuUmnvqESdR7mtNCYr3qS4iQLabs";
|
|
5
|
+
exports.DEFAULT_PINOCCHIO_PROGRAM_ID = "9KLLchQVJpGkw4jPuUmnvqESdR7mtNCYr3qS4iQLabs";
|
|
6
|
+
exports.SEED_CONFIG = "configmY}AGBJiqLabs";
|
|
7
|
+
exports.SEED_DB_ROOT = "rootmY}AGBJiqLabs";
|
|
8
|
+
exports.SEED_TABLE = "tablemY}AGBJiqLabs";
|
|
9
|
+
exports.SEED_TABLE_REF = "table-refmY}AGBJiqLabs";
|
|
10
|
+
exports.SEED_INSTRUCTION = "instructionmY}AGBJiqLabs";
|
|
11
|
+
exports.SEED_TARGET = "targetmY}AGBJiqLabs";
|
|
12
|
+
exports.SEED_USER = "usermY}AGBJiqLabs";
|
|
13
|
+
exports.SEED_BUNDLE = "bundlemY}AGBJiqLabs";
|
|
14
|
+
exports.SEED_CONNECTION = "connectionmY}AGAJiqLabs";
|
|
15
|
+
exports.SEED_CODE_ACCOUNT = "codemY}AGBJiqLabs";
|
|
16
|
+
exports.SEED_USER_INVENTORY = "inventorymY}AGBJiqLabs";
|
|
17
|
+
exports.CONNECTION_STATUS_PENDING = 0;
|
|
18
|
+
exports.CONNECTION_STATUS_APPROVED = 1;
|
|
19
|
+
exports.CONNECTION_STATUS_BLOCKED = 2;
|
|
20
|
+
exports.CONNECTION_BLOCKER_NONE = 255;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./discriminators"), exports);
|
|
19
|
+
__exportStar(require("./instructions"), exports);
|
|
20
|
+
__exportStar(require("./pda"), exports);
|
|
21
|
+
__exportStar(require("./profile"), exports);
|