@fepvenancio/stela-sdk 0.5.0 → 0.5.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 +29 -52
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,7 +117,6 @@ Return a `Call` object for use with `account.execute()`. Bundle multiple calls (
|
|
|
117
117
|
| `buildRepay(id)` | Repay a filled inscription |
|
|
118
118
|
| `buildLiquidate(id)` | Liquidate an expired inscription |
|
|
119
119
|
| `buildRedeem(id, shares)` | Redeem shares for underlying assets |
|
|
120
|
-
| `buildPrivateRedeem(request, proof)` | Redeem shares via the privacy pool with a ZK proof |
|
|
121
120
|
| `buildSettle(params)` | Settle an off-chain order (used by relayer bots) |
|
|
122
121
|
| `buildFillSignedOrder(order, sig, fillBps)` | Fill a signed order on-chain |
|
|
123
122
|
| `buildCancelOrder(order)` | Cancel a specific signed order |
|
|
@@ -136,7 +135,6 @@ Convenience wrappers that call `account.execute()` directly. Accept optional `ap
|
|
|
136
135
|
| `repay(id, approvals?)` | Repay a loan |
|
|
137
136
|
| `liquidate(id)` | Liquidate an expired loan |
|
|
138
137
|
| `redeem(id, shares)` | Redeem ERC1155 shares |
|
|
139
|
-
| `privateRedeem(request, proof)` | Redeem via privacy pool |
|
|
140
138
|
| `fillSignedOrder(order, sig, fillBps, approvals?)` | Fill a signed order |
|
|
141
139
|
| `cancelOrder(order)` | Cancel a signed order |
|
|
142
140
|
| `cancelOrdersByNonce(minNonce)` | Bulk cancel by nonce |
|
|
@@ -208,58 +206,13 @@ import {
|
|
|
208
206
|
| Function | Description |
|
|
209
207
|
|----------|-------------|
|
|
210
208
|
| `getInscriptionOrderTypedData(params)` | Build SNIP-12 typed data for a borrower's InscriptionOrder |
|
|
211
|
-
| `getLendOfferTypedData(params)` | Build SNIP-12 typed data for a lender's LendOffer
|
|
209
|
+
| `getLendOfferTypedData(params)` | Build SNIP-12 typed data for a lender's LendOffer |
|
|
212
210
|
| `hashAssets(assets)` | Poseidon hash of an asset array (matches Cairo's `hash_assets()`) |
|
|
213
211
|
| `serializeSignature(sig)` | Convert `string[]` signature to `{ r, s }` for storage |
|
|
214
212
|
| `deserializeSignature(stored)` | Convert `{ r, s }` back to `string[]` |
|
|
215
213
|
|
|
216
214
|
---
|
|
217
215
|
|
|
218
|
-
### Privacy Utilities
|
|
219
|
-
|
|
220
|
-
Functions for the privacy pool (shielded share commitments via Poseidon hashing).
|
|
221
|
-
|
|
222
|
-
```typescript
|
|
223
|
-
import {
|
|
224
|
-
createPrivateNote,
|
|
225
|
-
computeCommitment,
|
|
226
|
-
computeNullifier,
|
|
227
|
-
hashPair,
|
|
228
|
-
generateSalt,
|
|
229
|
-
} from '@fepvenancio/stela-sdk'
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
| Function | Returns | Description |
|
|
233
|
-
|----------|---------|-------------|
|
|
234
|
-
| `createPrivateNote(owner, inscriptionId, shares, salt?)` | `PrivateNote` | Generate a full private note (auto-generates salt if omitted) |
|
|
235
|
-
| `computeCommitment(owner, inscriptionId, shares, salt)` | `string` | Compute a Poseidon commitment hash |
|
|
236
|
-
| `computeNullifier(commitment, ownerSecret)` | `string` | Derive a nullifier from a commitment |
|
|
237
|
-
| `hashPair(left, right)` | `string` | Poseidon hash of two children (Merkle tree nodes) |
|
|
238
|
-
| `generateSalt()` | `string` | Random felt252 salt for commitment uniqueness |
|
|
239
|
-
|
|
240
|
-
#### Types
|
|
241
|
-
|
|
242
|
-
```typescript
|
|
243
|
-
interface PrivateNote {
|
|
244
|
-
owner: string
|
|
245
|
-
inscriptionId: bigint
|
|
246
|
-
shares: bigint
|
|
247
|
-
salt: string
|
|
248
|
-
commitment: string
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
interface PrivateRedeemRequest {
|
|
252
|
-
root: string // Merkle root the proof was generated against
|
|
253
|
-
inscriptionId: bigint
|
|
254
|
-
shares: bigint
|
|
255
|
-
nullifier: string // Prevents double-spend
|
|
256
|
-
changeCommitment: string // For partial redemption ('0' if full)
|
|
257
|
-
recipient: string
|
|
258
|
-
}
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
216
|
### Math Utilities
|
|
264
217
|
|
|
265
218
|
Share calculation helpers that mirror the on-chain math.
|
|
@@ -296,7 +249,7 @@ import { parseEvent, parseEvents, SELECTORS } from '@fepvenancio/stela-sdk'
|
|
|
296
249
|
| `parseEvent(raw)` | Parse a single raw event into a typed `StelaEvent` |
|
|
297
250
|
| `parseEvents(raws)` | Parse an array of raw events |
|
|
298
251
|
|
|
299
|
-
Supported event types: `InscriptionCreated`, `InscriptionSigned`, `InscriptionCancelled`, `InscriptionRepaid`, `InscriptionLiquidated`, `SharesRedeemed`, `TransferSingle`, `OrderSettled`, `OrderFilled`, `OrderCancelled`, `OrdersBulkCancelled
|
|
252
|
+
Supported event types: `InscriptionCreated`, `InscriptionSigned`, `InscriptionCancelled`, `InscriptionRepaid`, `InscriptionLiquidated`, `SharesRedeemed`, `TransferSingle`, `OrderSettled`, `OrderFilled`, `OrderCancelled`, `OrdersBulkCancelled`.
|
|
300
253
|
|
|
301
254
|
---
|
|
302
255
|
|
|
@@ -369,12 +322,28 @@ All exported types from the SDK:
|
|
|
369
322
|
| `LockerInfo` | Locker information from the API |
|
|
370
323
|
| `LockerState` | Locker address + unlock status |
|
|
371
324
|
| `LockerCall` | Call to execute through a locker |
|
|
325
|
+
| `RawEvent` | Raw StarkNet event (keys, data, tx_hash, block) |
|
|
372
326
|
| `StelaEvent` | Discriminated union of all protocol events |
|
|
373
|
-
| `
|
|
374
|
-
| `
|
|
327
|
+
| `InscriptionCreatedEvent` | InscriptionCreated event type |
|
|
328
|
+
| `InscriptionSignedEvent` | InscriptionSigned event type |
|
|
329
|
+
| `InscriptionCancelledEvent` | InscriptionCancelled event type |
|
|
330
|
+
| `InscriptionRepaidEvent` | InscriptionRepaid event type |
|
|
331
|
+
| `InscriptionLiquidatedEvent` | InscriptionLiquidated event type |
|
|
332
|
+
| `SharesRedeemedEvent` | SharesRedeemed event type |
|
|
333
|
+
| `TransferSingleEvent` | ERC1155 TransferSingle event type |
|
|
334
|
+
| `OrderSettledEvent` | OrderSettled event type |
|
|
335
|
+
| `OrderFilledEvent` | OrderFilled event type |
|
|
336
|
+
| `OrderCancelledEvent` | OrderCancelled event type |
|
|
337
|
+
| `OrdersBulkCancelledEvent` | OrdersBulkCancelled event type |
|
|
375
338
|
| `TokenInfo` | Token metadata (symbol, name, decimals, addresses) |
|
|
376
339
|
| `StatusInput` | Input for `computeStatus()` |
|
|
377
340
|
| `StoredSignature` | Serialized signature for storage (`{ r, s }`) |
|
|
341
|
+
| `InscriptionClientOptions` | Options for InscriptionClient constructor |
|
|
342
|
+
| `ShareClientOptions` | Options for ShareClient constructor |
|
|
343
|
+
| `ApiClientOptions` | Options for ApiClient constructor |
|
|
344
|
+
| `ListInscriptionsParams` | Parameters for `listInscriptions()` |
|
|
345
|
+
| `InscriptionEventRow` | API response row for inscription events |
|
|
346
|
+
| `StelaSdkOptions` | Options for StelaSdk constructor |
|
|
378
347
|
|
|
379
348
|
---
|
|
380
349
|
|
|
@@ -384,6 +353,8 @@ All exported types from the SDK:
|
|
|
384
353
|
|--------|-------------|
|
|
385
354
|
| `STELA_ADDRESS` | Contract addresses per network (`{ sepolia, mainnet }`) |
|
|
386
355
|
| `resolveNetwork(raw?)` | Validate/default network string |
|
|
356
|
+
| `CHAIN_ID` | SNIP-12 chain ID shortstrings per network (`{ sepolia: 'SN_SEPOLIA', mainnet: 'SN_MAIN' }`) |
|
|
357
|
+
| `EXPLORER_TX_URL` | Block explorer base URLs per network (for transaction links) |
|
|
387
358
|
| `MAX_BPS` | `10_000n` (100% in basis points) |
|
|
388
359
|
| `VIRTUAL_SHARE_OFFSET` | `1e16n` (share calculation offset) |
|
|
389
360
|
| `ASSET_TYPE_ENUM` | AssetType to numeric enum mapping |
|
|
@@ -391,13 +362,19 @@ All exported types from the SDK:
|
|
|
391
362
|
| `VALID_STATUSES` | Array of all valid inscription statuses |
|
|
392
363
|
| `STATUS_LABELS` | Human-readable status labels |
|
|
393
364
|
|
|
365
|
+
### Classes
|
|
366
|
+
|
|
367
|
+
| Export | Description |
|
|
368
|
+
|--------|-------------|
|
|
369
|
+
| `ApiError` | Error class thrown by ApiClient on HTTP failures |
|
|
370
|
+
|
|
394
371
|
### ABIs
|
|
395
372
|
|
|
396
373
|
The package ships raw ABI JSON files in `src/abi/`:
|
|
397
374
|
|
|
398
375
|
| File | Contents |
|
|
399
376
|
|------|----------|
|
|
400
|
-
| `src/abi/stela.json` | Full Stela protocol ABI (IStelaProtocol + ERC1155 + Ownable
|
|
377
|
+
| `src/abi/stela.json` | Full Stela protocol ABI (IStelaProtocol + ERC1155 + Ownable) |
|
|
401
378
|
| `src/abi/erc20.json` | Minimal ERC20 ABI (approve, balanceOf, allowance) |
|
|
402
379
|
| `src/abi/locker.json` | Locker account ABI (__execute__, is_unlocked) |
|
|
403
380
|
|