@fepvenancio/stela-sdk 0.6.0 → 0.6.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 +7 -1
- package/dist/index.cjs +63 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +63 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/stela.json +62 -0
package/README.md
CHANGED
|
@@ -118,6 +118,7 @@ Return a `Call` object for use with `account.execute()`. Bundle multiple calls (
|
|
|
118
118
|
| `buildLiquidate(id)` | Liquidate an expired inscription |
|
|
119
119
|
| `buildRedeem(id, shares)` | Redeem shares for underlying assets |
|
|
120
120
|
| `buildSettle(params)` | Settle an off-chain order (used by relayer bots) |
|
|
121
|
+
| `buildBatchSettle(params)` | Settle multiple off-chain orders atomically with 1 lender signature (BatchLendOffer) |
|
|
121
122
|
| `buildFillSignedOrder(order, sig, fillBps)` | Fill a signed order on-chain |
|
|
122
123
|
| `buildCancelOrder(order)` | Cancel a specific signed order |
|
|
123
124
|
| `buildCancelOrdersByNonce(minNonce)` | Bulk cancel orders below a nonce |
|
|
@@ -197,7 +198,9 @@ Functions for creating SNIP-12 typed data for gasless order creation and settlem
|
|
|
197
198
|
import {
|
|
198
199
|
getInscriptionOrderTypedData,
|
|
199
200
|
getLendOfferTypedData,
|
|
201
|
+
getBatchLendOfferTypedData,
|
|
200
202
|
hashAssets,
|
|
203
|
+
hashBatchEntries,
|
|
201
204
|
serializeSignature,
|
|
202
205
|
deserializeSignature,
|
|
203
206
|
} from '@fepvenancio/stela-sdk'
|
|
@@ -207,7 +210,9 @@ import {
|
|
|
207
210
|
|----------|-------------|
|
|
208
211
|
| `getInscriptionOrderTypedData(params)` | Build SNIP-12 typed data for a borrower's InscriptionOrder |
|
|
209
212
|
| `getLendOfferTypedData(params)` | Build SNIP-12 typed data for a lender's LendOffer |
|
|
213
|
+
| `getBatchLendOfferTypedData(params)` | Build SNIP-12 typed data for a lender's BatchLendOffer (multi-order settlement) |
|
|
210
214
|
| `hashAssets(assets)` | Poseidon hash of an asset array (matches Cairo's `hash_assets()`) |
|
|
215
|
+
| `hashBatchEntries(entries)` | Poseidon hash of BatchEntry array for batch_settle() |
|
|
211
216
|
| `serializeSignature(sig)` | Convert `string[]` signature to `{ r, s }` for storage |
|
|
212
217
|
| `deserializeSignature(stored)` | Convert `{ r, s }` back to `string[]` |
|
|
213
218
|
|
|
@@ -313,6 +318,7 @@ All exported types from the SDK:
|
|
|
313
318
|
| `StoredInscription` | Raw on-chain inscription data |
|
|
314
319
|
| `Inscription` | Parsed inscription with computed status |
|
|
315
320
|
| `SignedOrder` | Signed order for the matching engine |
|
|
321
|
+
| `BatchEntry` | Entry in a batch settle (order hash + fill BPS) |
|
|
316
322
|
| `InscriptionRow` | API response row for inscriptions |
|
|
317
323
|
| `AssetRow` | API response row for assets |
|
|
318
324
|
| `ApiListResponse<T>` | Paginated list response envelope |
|
|
@@ -397,7 +403,7 @@ npm publish --access public
|
|
|
397
403
|
|
|
398
404
|
## Running a Relayer
|
|
399
405
|
|
|
400
|
-
The Stela protocol is fully permissionless — anyone can run a relayer to settle matched orders and earn **
|
|
406
|
+
The Stela protocol is fully permissionless — anyone can run a relayer to settle matched orders and earn **0.05%** on every settlement. See [RELAYER.md](RELAYER.md) for the SDK integration guide and the [stela-relayer](https://github.com/fepvenancio/stela-relayer) repo for a standalone implementation.
|
|
401
407
|
|
|
402
408
|
## License
|
|
403
409
|
|
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var STATUS_LABELS = {
|
|
|
24
24
|
|
|
25
25
|
// src/constants/addresses.ts
|
|
26
26
|
var STELA_ADDRESS = {
|
|
27
|
-
sepolia: "
|
|
27
|
+
sepolia: "0x012998e49cc8205d0bb56b5c10202bd32994091b1cacdb7bcbd03dc6781d4974",
|
|
28
28
|
mainnet: "0x0"
|
|
29
29
|
};
|
|
30
30
|
var VALID_NETWORKS = ["sepolia", "mainnet"];
|
|
@@ -762,6 +762,28 @@ var stela_default = [
|
|
|
762
762
|
}
|
|
763
763
|
]
|
|
764
764
|
},
|
|
765
|
+
{
|
|
766
|
+
type: "struct",
|
|
767
|
+
name: "stela::snip12::BatchLendOffer",
|
|
768
|
+
members: [
|
|
769
|
+
{
|
|
770
|
+
name: "batch_hash",
|
|
771
|
+
type: "core::felt252"
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
name: "count",
|
|
775
|
+
type: "core::integer::u32"
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
name: "lender",
|
|
779
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
name: "start_nonce",
|
|
783
|
+
type: "core::felt252"
|
|
784
|
+
}
|
|
785
|
+
]
|
|
786
|
+
},
|
|
765
787
|
{
|
|
766
788
|
type: "struct",
|
|
767
789
|
name: "stela::types::signed_order::SignedOrder",
|
|
@@ -974,6 +996,46 @@ var stela_default = [
|
|
|
974
996
|
outputs: [],
|
|
975
997
|
state_mutability: "external"
|
|
976
998
|
},
|
|
999
|
+
{
|
|
1000
|
+
type: "function",
|
|
1001
|
+
name: "batch_settle",
|
|
1002
|
+
inputs: [
|
|
1003
|
+
{
|
|
1004
|
+
name: "orders",
|
|
1005
|
+
type: "core::array::Array::<stela::snip12::InscriptionOrder>"
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
name: "debt_assets_flat",
|
|
1009
|
+
type: "core::array::Array::<stela::types::asset::Asset>"
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
name: "interest_assets_flat",
|
|
1013
|
+
type: "core::array::Array::<stela::types::asset::Asset>"
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
name: "collateral_assets_flat",
|
|
1017
|
+
type: "core::array::Array::<stela::types::asset::Asset>"
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
name: "borrower_sigs",
|
|
1021
|
+
type: "core::array::Array::<core::array::Array::<core::felt252>>"
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
name: "batch_offer",
|
|
1025
|
+
type: "stela::snip12::BatchLendOffer"
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
name: "lender_sig",
|
|
1029
|
+
type: "core::array::Array::<core::felt252>"
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
name: "bps_list",
|
|
1033
|
+
type: "core::array::Array::<core::integer::u256>"
|
|
1034
|
+
}
|
|
1035
|
+
],
|
|
1036
|
+
outputs: [],
|
|
1037
|
+
state_mutability: "external"
|
|
1038
|
+
},
|
|
977
1039
|
{
|
|
978
1040
|
type: "function",
|
|
979
1041
|
name: "fill_signed_order",
|