@fepvenancio/stela-sdk 0.9.0 → 0.11.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 +184 -31
- package/dist/index.cjs +432 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +404 -1
- package/dist/index.d.ts +404 -1
- package/dist/index.js +404 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -98,6 +98,8 @@ interface InscriptionRow {
|
|
|
98
98
|
interest_asset_count: number;
|
|
99
99
|
collateral_asset_count: number;
|
|
100
100
|
created_at_ts: string;
|
|
101
|
+
auction_started: number;
|
|
102
|
+
auction_start_time: string;
|
|
101
103
|
assets: AssetRow[];
|
|
102
104
|
}
|
|
103
105
|
/** Asset row shape from the inscription_assets table */
|
|
@@ -141,6 +143,199 @@ interface LockerInfo {
|
|
|
141
143
|
locker_address: string;
|
|
142
144
|
is_unlocked: boolean;
|
|
143
145
|
}
|
|
146
|
+
/** Response shape for GET /api/inscriptions/[id] */
|
|
147
|
+
interface InscriptionDetailResponse extends InscriptionRow {
|
|
148
|
+
assets: AssetRow[];
|
|
149
|
+
}
|
|
150
|
+
/** Collection offer row from D1 */
|
|
151
|
+
interface CollectionOfferRow {
|
|
152
|
+
id: string;
|
|
153
|
+
lender: string;
|
|
154
|
+
collection_address: string;
|
|
155
|
+
order_data: Record<string, unknown>;
|
|
156
|
+
lender_signature: string;
|
|
157
|
+
nonce: string;
|
|
158
|
+
status: string;
|
|
159
|
+
deadline: string;
|
|
160
|
+
created_at: string;
|
|
161
|
+
debt_token: string | null;
|
|
162
|
+
collateral_token: string | null;
|
|
163
|
+
acceptance?: {
|
|
164
|
+
borrower: string;
|
|
165
|
+
token_id: string;
|
|
166
|
+
borrower_signature: string;
|
|
167
|
+
nonce: string;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/** Refinance offer row from D1 */
|
|
171
|
+
interface RefinanceRow {
|
|
172
|
+
id: string;
|
|
173
|
+
inscription_id: string;
|
|
174
|
+
new_lender: string;
|
|
175
|
+
order_data: Record<string, unknown>;
|
|
176
|
+
lender_signature: string;
|
|
177
|
+
nonce: string;
|
|
178
|
+
status: string;
|
|
179
|
+
deadline: string;
|
|
180
|
+
created_at: string;
|
|
181
|
+
approval?: {
|
|
182
|
+
borrower: string;
|
|
183
|
+
borrower_signature: string;
|
|
184
|
+
nonce: string;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/** Renegotiation proposal row from D1 */
|
|
188
|
+
interface RenegotiationRow {
|
|
189
|
+
id: string;
|
|
190
|
+
inscription_id: string;
|
|
191
|
+
proposer: string;
|
|
192
|
+
proposal_data: Record<string, unknown>;
|
|
193
|
+
proposer_signature: string;
|
|
194
|
+
nonce: string;
|
|
195
|
+
status: string;
|
|
196
|
+
deadline: string;
|
|
197
|
+
created_at: string;
|
|
198
|
+
}
|
|
199
|
+
/** Collateral sale row from D1 */
|
|
200
|
+
interface CollateralSaleRow {
|
|
201
|
+
id: string;
|
|
202
|
+
inscription_id: string;
|
|
203
|
+
buyer: string;
|
|
204
|
+
offer_data: Record<string, unknown>;
|
|
205
|
+
borrower_signature: string;
|
|
206
|
+
min_price: string;
|
|
207
|
+
status: string;
|
|
208
|
+
deadline: string;
|
|
209
|
+
created_at: string;
|
|
210
|
+
}
|
|
211
|
+
/** Off-chain order status */
|
|
212
|
+
type OrderStatus = 'pending' | 'matched' | 'settled' | 'expired' | 'cancelled';
|
|
213
|
+
/** Off-chain order row from D1 */
|
|
214
|
+
interface OrderRow {
|
|
215
|
+
id: string;
|
|
216
|
+
borrower: string;
|
|
217
|
+
order_data: Record<string, unknown> | string;
|
|
218
|
+
borrower_signature: string | null;
|
|
219
|
+
nonce: string;
|
|
220
|
+
status: string;
|
|
221
|
+
deadline: string;
|
|
222
|
+
created_at: string;
|
|
223
|
+
}
|
|
224
|
+
/** Lender offer row from D1 */
|
|
225
|
+
interface OrderOfferRow {
|
|
226
|
+
id: string;
|
|
227
|
+
order_id: string;
|
|
228
|
+
lender: string;
|
|
229
|
+
bps: number;
|
|
230
|
+
lender_signature: string | null;
|
|
231
|
+
nonce: string;
|
|
232
|
+
status: string;
|
|
233
|
+
created_at: string;
|
|
234
|
+
tx_hash: string | null;
|
|
235
|
+
}
|
|
236
|
+
/** Share listing row from D1 (secondary market) */
|
|
237
|
+
interface ShareListingRow {
|
|
238
|
+
id: string;
|
|
239
|
+
inscription_id: string;
|
|
240
|
+
seller: string;
|
|
241
|
+
shares: string;
|
|
242
|
+
ask_price: string;
|
|
243
|
+
ask_token: string;
|
|
244
|
+
status: string;
|
|
245
|
+
created_at: string;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** Order book types — shared between API and UI */
|
|
249
|
+
/** A single price level in the lending order book */
|
|
250
|
+
interface LendingLevel {
|
|
251
|
+
/** Annualized percentage rate for this level */
|
|
252
|
+
apr: number;
|
|
253
|
+
/** Total debt amount available at this APR (raw string for BigInt compat) */
|
|
254
|
+
totalAmount: string;
|
|
255
|
+
/** Number of orders at this level */
|
|
256
|
+
orderCount: number;
|
|
257
|
+
/** Running cumulative total from best to worst */
|
|
258
|
+
cumulative: string;
|
|
259
|
+
/** Individual orders at this level */
|
|
260
|
+
orders: {
|
|
261
|
+
id: string;
|
|
262
|
+
amount: string;
|
|
263
|
+
creator: string;
|
|
264
|
+
source: 'offchain' | 'onchain';
|
|
265
|
+
duration: number;
|
|
266
|
+
multiLender: boolean;
|
|
267
|
+
deadline: number;
|
|
268
|
+
interestAmount: string;
|
|
269
|
+
interestSymbol: string;
|
|
270
|
+
interestDecimals: number;
|
|
271
|
+
}[];
|
|
272
|
+
}
|
|
273
|
+
/** A single price level in the swap order book */
|
|
274
|
+
interface SwapLevel {
|
|
275
|
+
/** Exchange rate: units of quote per unit of base */
|
|
276
|
+
rate: number;
|
|
277
|
+
/** Total base amount available at this rate */
|
|
278
|
+
totalAmount: string;
|
|
279
|
+
/** Number of orders at this level */
|
|
280
|
+
orderCount: number;
|
|
281
|
+
/** Running cumulative total from best to worst */
|
|
282
|
+
cumulative: string;
|
|
283
|
+
/** Individual orders */
|
|
284
|
+
orders: {
|
|
285
|
+
id: string;
|
|
286
|
+
amount: string;
|
|
287
|
+
creator: string;
|
|
288
|
+
source: 'offchain' | 'onchain';
|
|
289
|
+
deadline: number;
|
|
290
|
+
}[];
|
|
291
|
+
}
|
|
292
|
+
/** Token info for display in order book context */
|
|
293
|
+
interface TokenDisplay {
|
|
294
|
+
address: string;
|
|
295
|
+
symbol: string;
|
|
296
|
+
decimals: number;
|
|
297
|
+
logoUrl?: string;
|
|
298
|
+
}
|
|
299
|
+
/** Full order book response from API */
|
|
300
|
+
interface OrderBookResponse {
|
|
301
|
+
pair: {
|
|
302
|
+
base: TokenDisplay;
|
|
303
|
+
quote: TokenDisplay;
|
|
304
|
+
};
|
|
305
|
+
/** Available duration values for lending orders */
|
|
306
|
+
durations: number[];
|
|
307
|
+
/** Lending order book (duration > 0) */
|
|
308
|
+
lending: {
|
|
309
|
+
/** Borrow requests — sorted highest APR first (best for lenders) */
|
|
310
|
+
asks: LendingLevel[];
|
|
311
|
+
/** Total borrow demand */
|
|
312
|
+
totalAskVolume: string;
|
|
313
|
+
};
|
|
314
|
+
/** Swap order book (duration = 0) */
|
|
315
|
+
swaps: {
|
|
316
|
+
/** Sell base (want quote) — sorted lowest rate first */
|
|
317
|
+
asks: SwapLevel[];
|
|
318
|
+
/** Buy base (want base, pay quote) — sorted highest rate first */
|
|
319
|
+
bids: SwapLevel[];
|
|
320
|
+
totalAskVolume: string;
|
|
321
|
+
totalBidVolume: string;
|
|
322
|
+
};
|
|
323
|
+
/** Recently settled/filled orders */
|
|
324
|
+
recentFills: {
|
|
325
|
+
id: string;
|
|
326
|
+
apr: number;
|
|
327
|
+
rate: number;
|
|
328
|
+
amount: string;
|
|
329
|
+
duration: number;
|
|
330
|
+
filledAt: number;
|
|
331
|
+
source: 'offchain' | 'onchain';
|
|
332
|
+
type: 'lending' | 'swap';
|
|
333
|
+
}[];
|
|
334
|
+
}
|
|
335
|
+
/** Duration filter options */
|
|
336
|
+
type DurationFilter = 'all' | '7d' | '30d' | '90d' | '180d' | '365d';
|
|
337
|
+
/** Duration filter to seconds mapping */
|
|
338
|
+
declare const DURATION_RANGES: Record<DurationFilter, [number, number] | null>;
|
|
144
339
|
|
|
145
340
|
/** Raw event as returned from StarkNet RPC */
|
|
146
341
|
interface RawEvent {
|
|
@@ -309,6 +504,37 @@ declare const AUCTION_PENALTY_BPS = 500n;
|
|
|
309
504
|
/** Minimum auction price as percentage of debt (10% floor in BPS) */
|
|
310
505
|
declare const AUCTION_RESERVE_BPS = 1000n;
|
|
311
506
|
|
|
507
|
+
/**
|
|
508
|
+
* Trade UI presets for deadlines and durations.
|
|
509
|
+
*
|
|
510
|
+
* Shared between frontend (form dropdowns) and backend (validation bounds).
|
|
511
|
+
* Does NOT import any framework-specific code.
|
|
512
|
+
*/
|
|
513
|
+
interface DeadlinePreset {
|
|
514
|
+
label: string;
|
|
515
|
+
seconds: number;
|
|
516
|
+
}
|
|
517
|
+
interface DurationPreset {
|
|
518
|
+
label: string;
|
|
519
|
+
seconds: number;
|
|
520
|
+
}
|
|
521
|
+
/** Short-lived deadline options used on the Swap form. */
|
|
522
|
+
declare const SWAP_DEADLINE_PRESETS: DeadlinePreset[];
|
|
523
|
+
/** Longer-lived deadline options used on the Lend / Borrow form. */
|
|
524
|
+
declare const LEND_DEADLINE_PRESETS: DeadlinePreset[];
|
|
525
|
+
/** Loan duration options (how long the borrower has to repay). */
|
|
526
|
+
declare const DURATION_PRESETS: DurationPreset[];
|
|
527
|
+
/**
|
|
528
|
+
* Convert a duration in seconds to a short human-readable string.
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* formatDurationHuman(300) // "5 min"
|
|
532
|
+
* formatDurationHuman(7200) // "2 hours"
|
|
533
|
+
* formatDurationHuman(86400) // "1 day"
|
|
534
|
+
* formatDurationHuman(604800) // "7 days"
|
|
535
|
+
*/
|
|
536
|
+
declare function formatDurationHuman(seconds: number): string;
|
|
537
|
+
|
|
312
538
|
/** Convert a bigint to a [low, high] calldata pair for StarkNet u256 */
|
|
313
539
|
declare const toU256: (n: bigint) => [string, string];
|
|
314
540
|
/** Convert a { low, high } u256 pair back to a bigint */
|
|
@@ -353,6 +579,140 @@ interface StatusInput {
|
|
|
353
579
|
}
|
|
354
580
|
/** Compute the inscription status from on-chain fields */
|
|
355
581
|
declare function computeStatus(a: StatusInput, nowSeconds?: number): InscriptionStatus;
|
|
582
|
+
/** Enriched status includes display-only states not in InscriptionStatus */
|
|
583
|
+
type EnrichedStatus = InscriptionStatus | 'overdue' | 'grace_period' | 'auctioned';
|
|
584
|
+
/** Badge variant type for UI — union of inscription + order statuses */
|
|
585
|
+
type StatusBadgeVariant = 'open' | 'partial' | 'filled' | 'repaid' | 'liquidated' | 'expired' | 'overdue' | 'cancelled' | 'pending' | 'matched' | 'settled' | 'auctioned' | 'grace_period';
|
|
586
|
+
/** Map any status string to a valid badge variant, defaulting to 'open'. */
|
|
587
|
+
declare function getStatusBadgeVariant(status: string): StatusBadgeVariant;
|
|
588
|
+
/** Map any status string to its human-readable label. */
|
|
589
|
+
declare function getStatusLabel(status: string): string;
|
|
590
|
+
/** Human-readable labels for off-chain order statuses */
|
|
591
|
+
declare const ORDER_STATUS_LABELS: Record<string, string>;
|
|
592
|
+
/** Map off-chain order status to its own badge variant. */
|
|
593
|
+
declare function getOrderStatusBadgeVariant(status: string): StatusBadgeVariant;
|
|
594
|
+
/** Get the human-readable label for an off-chain order status. */
|
|
595
|
+
declare function getOrderStatusLabel(status: string): string;
|
|
596
|
+
/** Enriched inscription statuses that belong to each filter group. */
|
|
597
|
+
declare const INSCRIPTION_STATUS_GROUPS: Record<string, Set<string>>;
|
|
598
|
+
/** Off-chain order statuses that belong to each filter group. */
|
|
599
|
+
declare const ORDER_STATUS_GROUPS: Record<string, Set<string>>;
|
|
600
|
+
/** Check if an enriched inscription status belongs to a filter group. */
|
|
601
|
+
declare function inscriptionMatchesGroup(enrichedStatus: string, group: string): boolean;
|
|
602
|
+
/** Check if an order status belongs to a filter group. */
|
|
603
|
+
declare function orderMatchesGroup(orderStatus: string, group: string): boolean;
|
|
604
|
+
/** Detailed status descriptions for UI tooltips */
|
|
605
|
+
declare const STATUS_DESCRIPTIONS: Record<string, string>;
|
|
606
|
+
/** Concept descriptions for UI help text */
|
|
607
|
+
declare const CONCEPT_DESCRIPTIONS: Record<string, string>;
|
|
608
|
+
/**
|
|
609
|
+
* Enrich an InscriptionRow with a client-side computed status.
|
|
610
|
+
* Distinguishes "overdue" (filled past duration) from "expired" (unfilled past deadline),
|
|
611
|
+
* and detects "grace_period" and "auctioned" states.
|
|
612
|
+
*/
|
|
613
|
+
declare function enrichStatus(row: {
|
|
614
|
+
status: string;
|
|
615
|
+
signed_at: string | null;
|
|
616
|
+
duration: string;
|
|
617
|
+
issued_debt_percentage: string;
|
|
618
|
+
deadline: string;
|
|
619
|
+
auction_started?: number;
|
|
620
|
+
}): EnrichedStatus;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Shared order data parsing utilities.
|
|
624
|
+
*
|
|
625
|
+
* Used by API routes (server) and UI components (client) to normalize
|
|
626
|
+
* the flexible order_data JSON from D1 into a consistent shape.
|
|
627
|
+
*/
|
|
628
|
+
interface SerializedAsset {
|
|
629
|
+
asset_address: string;
|
|
630
|
+
asset_type: string;
|
|
631
|
+
value: string;
|
|
632
|
+
token_id: string;
|
|
633
|
+
}
|
|
634
|
+
interface RawOrderData {
|
|
635
|
+
borrower?: string;
|
|
636
|
+
debt_assets?: SerializedAsset[];
|
|
637
|
+
interest_assets?: SerializedAsset[];
|
|
638
|
+
collateral_assets?: SerializedAsset[];
|
|
639
|
+
debtAssets?: SerializedAsset[];
|
|
640
|
+
interestAssets?: SerializedAsset[];
|
|
641
|
+
collateralAssets?: SerializedAsset[];
|
|
642
|
+
multi_lender?: boolean;
|
|
643
|
+
multiLender?: boolean;
|
|
644
|
+
duration?: string;
|
|
645
|
+
deadline?: string;
|
|
646
|
+
nonce?: string;
|
|
647
|
+
orderHash?: string;
|
|
648
|
+
}
|
|
649
|
+
interface ParsedOrderData {
|
|
650
|
+
borrower: string;
|
|
651
|
+
debtAssets: SerializedAsset[];
|
|
652
|
+
interestAssets: SerializedAsset[];
|
|
653
|
+
collateralAssets: SerializedAsset[];
|
|
654
|
+
duration: string;
|
|
655
|
+
deadline: string;
|
|
656
|
+
multiLender: boolean;
|
|
657
|
+
}
|
|
658
|
+
/** Normalize camelCase/snake_case variants in order_data JSON. */
|
|
659
|
+
declare function normalizeOrderData(raw: RawOrderData): ParsedOrderData;
|
|
660
|
+
/**
|
|
661
|
+
* Parse the order_data TEXT column from D1 into a proper object.
|
|
662
|
+
* Shared between GET /api/orders and GET /api/orders/[id].
|
|
663
|
+
*
|
|
664
|
+
* - Parses JSON string or passes through object
|
|
665
|
+
* - Sanitizes asset arrays
|
|
666
|
+
* - Only includes borrower_signature for pending orders
|
|
667
|
+
*/
|
|
668
|
+
declare function parseOrderRow(row: Record<string, unknown>): Record<string, unknown>;
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Shared signature utilities for parsing and formatting StarkNet signatures.
|
|
672
|
+
*
|
|
673
|
+
* Used by settlement hooks, API routes, and UI components to normalize
|
|
674
|
+
* the various wallet signature formats into consistent string arrays.
|
|
675
|
+
*/
|
|
676
|
+
/**
|
|
677
|
+
* Format a wallet signature response (array or {r, s} object) into a string array.
|
|
678
|
+
* Converts bigint values to hex strings.
|
|
679
|
+
*/
|
|
680
|
+
declare function formatSig(signature: unknown): string[];
|
|
681
|
+
/**
|
|
682
|
+
* Parse a stored signature (string, JSON string, or string array) into a string array.
|
|
683
|
+
* Handles formats: `[r, s]` array, `"[r, s]"` JSON, `"{r, s}"` JSON object, `"r,s"` CSV.
|
|
684
|
+
*/
|
|
685
|
+
declare function parseSigToArray(raw: string | string[]): string[];
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Calldata serialization/deserialization for StarkNet transactions.
|
|
689
|
+
*
|
|
690
|
+
* Used by the indexer (parsing tx calldata) and settlement bot
|
|
691
|
+
* (building calldata for create_inscription / settle / batch_settle).
|
|
692
|
+
*/
|
|
693
|
+
|
|
694
|
+
/** Asset shape used in calldata serialization (string values, not bigint) */
|
|
695
|
+
interface StoredAsset {
|
|
696
|
+
asset_address: string;
|
|
697
|
+
asset_type: AssetType;
|
|
698
|
+
value: string;
|
|
699
|
+
token_id: string;
|
|
700
|
+
}
|
|
701
|
+
/** Serialize an asset array into calldata: [len, ...per-asset fields] */
|
|
702
|
+
declare function serializeAssetCalldata(assets: StoredAsset[]): string[];
|
|
703
|
+
/** Parse an asset array from raw RPC calldata */
|
|
704
|
+
declare function parseAssetArray(calldata: string[], offset: number): {
|
|
705
|
+
assets: StoredAsset[];
|
|
706
|
+
nextOffset: number;
|
|
707
|
+
};
|
|
708
|
+
/** Serialize a signature string "r,s" or JSON [r, s] into calldata: [len, ...parts] */
|
|
709
|
+
declare function serializeSignatureCalldata(sig: string): string[];
|
|
710
|
+
/** Extract and parse inscription assets from transaction calldata */
|
|
711
|
+
declare function parseInscriptionCalldata(calldata: string[]): {
|
|
712
|
+
debt: StoredAsset[];
|
|
713
|
+
interest: StoredAsset[];
|
|
714
|
+
collateral: StoredAsset[];
|
|
715
|
+
} | null;
|
|
356
716
|
|
|
357
717
|
interface TokenInfo {
|
|
358
718
|
symbol: string;
|
|
@@ -507,6 +867,19 @@ declare function computeSafePositionFloor(params: {
|
|
|
507
867
|
interestFloor: AssetValue[];
|
|
508
868
|
};
|
|
509
869
|
|
|
870
|
+
/**
|
|
871
|
+
* Compute interest rate as a ratio of interest value to debt value.
|
|
872
|
+
* Skips ERC721 assets (no fungible value). Returns null if debt total is zero.
|
|
873
|
+
* Used by both the settlement bot (priority) and frontend (rank display).
|
|
874
|
+
*/
|
|
875
|
+
declare function computeInterestRate(debtAssets: {
|
|
876
|
+
asset_type: string;
|
|
877
|
+
value: string;
|
|
878
|
+
}[], interestAssets: {
|
|
879
|
+
asset_type: string;
|
|
880
|
+
value: string;
|
|
881
|
+
}[]): number | null;
|
|
882
|
+
|
|
510
883
|
/** Event selectors for all Stela protocol events */
|
|
511
884
|
declare const SELECTORS: {
|
|
512
885
|
readonly InscriptionCreated: string;
|
|
@@ -552,6 +925,14 @@ declare function hashBatchEntries(entries: BatchEntry[]): string;
|
|
|
552
925
|
*/
|
|
553
926
|
declare function hashAssets(assets: Asset[]): string;
|
|
554
927
|
|
|
928
|
+
/**
|
|
929
|
+
* Build SNIP-12 typed data for an order cancellation.
|
|
930
|
+
*
|
|
931
|
+
* The borrower signs this to prove they want to cancel their order.
|
|
932
|
+
* Both client and server must produce the same typed data to agree
|
|
933
|
+
* on the message hash that gets verified via is_valid_signature.
|
|
934
|
+
*/
|
|
935
|
+
declare function getCancelOrderTypedData(orderId: string, chainId: string): TypedData;
|
|
555
936
|
/**
|
|
556
937
|
* Build SNIP-12 TypedData for a borrower's InscriptionOrder.
|
|
557
938
|
* The borrower signs this off-chain to create an order without gas.
|
|
@@ -674,6 +1055,18 @@ declare function getRefinanceApprovalTypedData(params: {
|
|
|
674
1055
|
nonce: bigint;
|
|
675
1056
|
chainId: string;
|
|
676
1057
|
}): TypedData;
|
|
1058
|
+
/**
|
|
1059
|
+
* Build SNIP-12 TypedData for a terms-of-use acknowledgment.
|
|
1060
|
+
* The user signs this off-chain to prove they accepted the protocol terms.
|
|
1061
|
+
* NOT verified on-chain — stored off-chain as proof of consent.
|
|
1062
|
+
*/
|
|
1063
|
+
declare function getTermsAcknowledgmentTypedData(params: {
|
|
1064
|
+
user: string;
|
|
1065
|
+
termsVersion: string;
|
|
1066
|
+
termsHash: string;
|
|
1067
|
+
agreedAt: bigint;
|
|
1068
|
+
chainId: string;
|
|
1069
|
+
}): TypedData;
|
|
677
1070
|
|
|
678
1071
|
/**
|
|
679
1072
|
* Serialize a starknet.js signature (Signature type) for storage in D1.
|
|
@@ -1089,4 +1482,14 @@ declare class StelaSdk {
|
|
|
1089
1482
|
constructor(opts: StelaSdkOptions);
|
|
1090
1483
|
}
|
|
1091
1484
|
|
|
1092
|
-
|
|
1485
|
+
/**
|
|
1486
|
+
* Read the on-chain nonce for an address from the Stela contract.
|
|
1487
|
+
*
|
|
1488
|
+
* Uses 'latest' block — Cartridge RPC does not support 'pending'.
|
|
1489
|
+
* All nonce reads (frontend, server verify, API route) MUST use the same
|
|
1490
|
+
* block tag. The server-side processCreateOrder has a grace window to
|
|
1491
|
+
* account for nonces consumed in recent blocks not yet in 'latest'.
|
|
1492
|
+
*/
|
|
1493
|
+
declare function getNonce(provider: RpcProvider, stelaAddress: string, accountAddress: string): Promise<bigint>;
|
|
1494
|
+
|
|
1495
|
+
export { ASSET_TYPE_ENUM, ASSET_TYPE_NAMES, AUCTION_DURATION, AUCTION_PENALTY_BPS, AUCTION_RESERVE_BPS, type AccruedInterestEntry, ApiClient, type ApiClientOptions, type ApiDetailResponse, ApiError, type ApiListResponse, type Asset, type AssetRow, type AssetType, type AssetValue, type AuctionBidEvent, type AuctionStartedEvent, type BatchEntry, CHAIN_ID, CONCEPT_DESCRIPTIONS, type Call, type CollateralSaleRow, type CollectionOfferRow, DEFAULT_DUST_BUFFER_SECONDS, DURATION_PRESETS, DURATION_RANGES, type DeadlinePreset, type DurationFilter, type DurationPreset, EXPLORER_TX_URL, type EnrichedStatus, GRACE_PERIOD, INSCRIPTION_STATUS_GROUPS, type Inscription, type InscriptionCancelledEvent, InscriptionClient, type InscriptionClientOptions, type InscriptionCreatedEvent, type InscriptionDetailResponse, type InscriptionEventRow, type InscriptionLiquidatedEvent, type InscriptionParams, type InscriptionRepaidEvent, type InscriptionRow, type InscriptionSignedEvent, type InscriptionStatus, LEND_DEADLINE_PRESETS, type LendingLevel, type ListInscriptionsParams, type LockerCall, LockerClient, type LockerInfo, type LockerState, MAX_BPS, type Network, ORDER_STATUS_GROUPS, ORDER_STATUS_LABELS, type OrderBookResponse, type OrderCancelledEvent, type OrderFilledEvent, type OrderOfferRow, type OrderRow, type OrderSettledEvent, type OrderStatus, type OrdersBulkCancelledEvent, type ParsedOrderData, type PositionValue, type RawEvent, type RawOrderData, type RefinanceRow, type RenegotiationRow, SELECTORS, STATUS_DESCRIPTIONS, STATUS_LABELS, STELA_ADDRESS, SWAP_DEADLINE_PRESETS, type SerializedAsset, type ShareBalance, ShareClient, type ShareClientOptions, type ShareListingRow, type SharesRedeemedEvent, type SignedOrder, type StatusBadgeVariant, type StatusInput, type StelaEvent, StelaSdk, type StelaSdkOptions, type StoredAsset, type StoredInscription, type StoredSignature, type SwapLevel, TOKENS, type TokenDisplay, type TokenInfo, type TransferSingleEvent, type TreasuryAsset, VALID_STATUSES, VIRTUAL_SHARE_OFFSET, accruedInterestWithBuffer, addressesEqual, calculateFeeShares, computeInterestRate, computePositionValue, computeSafePositionFloor, computeStatus, convertToShares, deserializeSignature, divCeil, enrichStatus, findTokenByAddress, formatAddress, formatDuration, formatDurationHuman, formatSig, formatTimestamp, formatTokenValue, fromU256, getBatchLendOfferTypedData, getCancelOrderTypedData, getCollateralSaleOfferTypedData, getCollectionBorrowAcceptanceTypedData, getCollectionLendOfferTypedData, getInscriptionOrderTypedData, getLendOfferTypedData, getNFTCollections, getNonce, getOrderStatusBadgeVariant, getOrderStatusLabel, getRefinanceApprovalTypedData, getRefinanceOfferTypedData, getRenegotiationProposalTypedData, getStatusBadgeVariant, getStatusLabel, getTermsAcknowledgmentTypedData, getTokensForNetwork, hashAssets, hashBatchEntries, inscriptionIdToHex, inscriptionMatchesGroup, normalizeAddress, normalizeOrderData, orderMatchesGroup, parseAmount, parseAssetArray, parseEvent, parseEvents, parseInscriptionCalldata, parseOrderRow, parseSigToArray, proRataInterest, proportionalAssetValue, resolveNetwork, scaleByPercentage, serializeAssetCalldata, serializeSignature, serializeSignatureCalldata, shareProportionBps, sharesToPercentage, toHex, toU256 };
|