@fepvenancio/stela-sdk 0.6.0 → 0.7.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 +7 -1
- package/dist/index.cjs +98 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +98 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/stela.json +97 -33
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: "0x038a0b195e011fbfd75e9bce9bbc4137ebc5296882e11c5769c333b90bda4f89",
|
|
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",
|
|
@@ -1070,17 +1132,6 @@ var stela_default = [
|
|
|
1070
1132
|
],
|
|
1071
1133
|
state_mutability: "view"
|
|
1072
1134
|
},
|
|
1073
|
-
{
|
|
1074
|
-
type: "function",
|
|
1075
|
-
name: "get_inscription_fee",
|
|
1076
|
-
inputs: [],
|
|
1077
|
-
outputs: [
|
|
1078
|
-
{
|
|
1079
|
-
type: "core::integer::u256"
|
|
1080
|
-
}
|
|
1081
|
-
],
|
|
1082
|
-
state_mutability: "view"
|
|
1083
|
-
},
|
|
1084
1135
|
{
|
|
1085
1136
|
type: "function",
|
|
1086
1137
|
name: "nonces",
|
|
@@ -1097,17 +1148,6 @@ var stela_default = [
|
|
|
1097
1148
|
],
|
|
1098
1149
|
state_mutability: "view"
|
|
1099
1150
|
},
|
|
1100
|
-
{
|
|
1101
|
-
type: "function",
|
|
1102
|
-
name: "get_relayer_fee",
|
|
1103
|
-
inputs: [],
|
|
1104
|
-
outputs: [
|
|
1105
|
-
{
|
|
1106
|
-
type: "core::integer::u256"
|
|
1107
|
-
}
|
|
1108
|
-
],
|
|
1109
|
-
state_mutability: "view"
|
|
1110
|
-
},
|
|
1111
1151
|
{
|
|
1112
1152
|
type: "function",
|
|
1113
1153
|
name: "get_treasury",
|
|
@@ -1223,15 +1263,19 @@ var stela_default = [
|
|
|
1223
1263
|
},
|
|
1224
1264
|
{
|
|
1225
1265
|
type: "function",
|
|
1226
|
-
name: "
|
|
1266
|
+
name: "is_volume_token_whitelisted",
|
|
1227
1267
|
inputs: [
|
|
1228
1268
|
{
|
|
1229
|
-
name: "
|
|
1230
|
-
type: "core::
|
|
1269
|
+
name: "token",
|
|
1270
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1231
1271
|
}
|
|
1232
1272
|
],
|
|
1233
|
-
outputs: [
|
|
1234
|
-
|
|
1273
|
+
outputs: [
|
|
1274
|
+
{
|
|
1275
|
+
type: "core::bool"
|
|
1276
|
+
}
|
|
1277
|
+
],
|
|
1278
|
+
state_mutability: "view"
|
|
1235
1279
|
},
|
|
1236
1280
|
{
|
|
1237
1281
|
type: "function",
|
|
@@ -1271,11 +1315,11 @@ var stela_default = [
|
|
|
1271
1315
|
},
|
|
1272
1316
|
{
|
|
1273
1317
|
type: "function",
|
|
1274
|
-
name: "
|
|
1318
|
+
name: "set_implementation_hash",
|
|
1275
1319
|
inputs: [
|
|
1276
1320
|
{
|
|
1277
|
-
name: "
|
|
1278
|
-
type: "core::
|
|
1321
|
+
name: "implementation_hash",
|
|
1322
|
+
type: "core::felt252"
|
|
1279
1323
|
}
|
|
1280
1324
|
],
|
|
1281
1325
|
outputs: [],
|
|
@@ -1283,11 +1327,15 @@ var stela_default = [
|
|
|
1283
1327
|
},
|
|
1284
1328
|
{
|
|
1285
1329
|
type: "function",
|
|
1286
|
-
name: "
|
|
1330
|
+
name: "set_volume_token_whitelisted",
|
|
1287
1331
|
inputs: [
|
|
1288
1332
|
{
|
|
1289
|
-
name: "
|
|
1290
|
-
type: "core::
|
|
1333
|
+
name: "token",
|
|
1334
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
name: "whitelisted",
|
|
1338
|
+
type: "core::bool"
|
|
1291
1339
|
}
|
|
1292
1340
|
],
|
|
1293
1341
|
outputs: [],
|
|
@@ -1330,6 +1378,18 @@ var stela_default = [
|
|
|
1330
1378
|
],
|
|
1331
1379
|
state_mutability: "view"
|
|
1332
1380
|
},
|
|
1381
|
+
{
|
|
1382
|
+
type: "function",
|
|
1383
|
+
name: "set_pauser",
|
|
1384
|
+
inputs: [
|
|
1385
|
+
{
|
|
1386
|
+
name: "new_pauser",
|
|
1387
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1388
|
+
}
|
|
1389
|
+
],
|
|
1390
|
+
outputs: [],
|
|
1391
|
+
state_mutability: "external"
|
|
1392
|
+
},
|
|
1333
1393
|
{
|
|
1334
1394
|
type: "function",
|
|
1335
1395
|
name: "set_locker_allowed_selector",
|
|
@@ -1338,6 +1398,10 @@ var stela_default = [
|
|
|
1338
1398
|
name: "locker",
|
|
1339
1399
|
type: "core::starknet::contract_address::ContractAddress"
|
|
1340
1400
|
},
|
|
1401
|
+
{
|
|
1402
|
+
name: "target",
|
|
1403
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
1404
|
+
},
|
|
1341
1405
|
{
|
|
1342
1406
|
name: "selector",
|
|
1343
1407
|
type: "core::felt252"
|
|
@@ -2366,10 +2430,6 @@ var InscriptionClient = class {
|
|
|
2366
2430
|
const result = await this.contract.call("get_locker", toU256(inscriptionId));
|
|
2367
2431
|
return String(result[0]);
|
|
2368
2432
|
}
|
|
2369
|
-
async getInscriptionFee() {
|
|
2370
|
-
const result = await this.contract.call("get_inscription_fee");
|
|
2371
|
-
return extractU256(result);
|
|
2372
|
-
}
|
|
2373
2433
|
async convertToShares(inscriptionId, percentage) {
|
|
2374
2434
|
const result = await this.contract.call("convert_to_shares", [
|
|
2375
2435
|
...toU256(inscriptionId),
|