@fepvenancio/stela-sdk 0.5.4 → 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 +143 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +142 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/stela.json +62 -0
package/dist/index.d.cts
CHANGED
|
@@ -371,6 +371,17 @@ declare function parseEvent(raw: RawEvent): StelaEvent | null;
|
|
|
371
371
|
/** Parse an array of raw events, skipping unrecognized ones. */
|
|
372
372
|
declare function parseEvents(rawEvents: RawEvent[]): StelaEvent[];
|
|
373
373
|
|
|
374
|
+
interface BatchEntry {
|
|
375
|
+
orderHash: string;
|
|
376
|
+
bps: bigint;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Hash an array of BatchEntry using Poseidon -- matches Cairo's hash_batch_entries().
|
|
380
|
+
*
|
|
381
|
+
* Format: Poseidon(count, order_hash_1, u256_hash(bps_1), order_hash_2, u256_hash(bps_2), ...)
|
|
382
|
+
* where u256_hash(bps) = Poseidon(U256_TYPE_HASH, low, high)
|
|
383
|
+
*/
|
|
384
|
+
declare function hashBatchEntries(entries: BatchEntry[]): string;
|
|
374
385
|
/**
|
|
375
386
|
* Hash an array of assets using Poseidon -- matches Cairo's hash_assets().
|
|
376
387
|
*
|
|
@@ -414,6 +425,17 @@ declare function getLendOfferTypedData(params: {
|
|
|
414
425
|
nonce: bigint;
|
|
415
426
|
chainId: string;
|
|
416
427
|
}): TypedData;
|
|
428
|
+
/**
|
|
429
|
+
* Build SNIP-12 TypedData for a lender's BatchLendOffer.
|
|
430
|
+
* The lender signs this off-chain to accept multiple orders atomically.
|
|
431
|
+
*/
|
|
432
|
+
declare function getBatchLendOfferTypedData(params: {
|
|
433
|
+
batchHash: string;
|
|
434
|
+
count: number;
|
|
435
|
+
lender: string;
|
|
436
|
+
startNonce: bigint;
|
|
437
|
+
chainId: string;
|
|
438
|
+
}): TypedData;
|
|
417
439
|
|
|
418
440
|
/**
|
|
419
441
|
* Serialize a starknet.js signature (Signature type) for storage in D1.
|
|
@@ -479,6 +501,33 @@ declare class InscriptionClient {
|
|
|
479
501
|
};
|
|
480
502
|
lenderSig: string[];
|
|
481
503
|
}): Call;
|
|
504
|
+
buildBatchSettle(params: {
|
|
505
|
+
orders: Array<{
|
|
506
|
+
borrower: string;
|
|
507
|
+
debtHash: string;
|
|
508
|
+
interestHash: string;
|
|
509
|
+
collateralHash: string;
|
|
510
|
+
debtCount: number;
|
|
511
|
+
interestCount: number;
|
|
512
|
+
collateralCount: number;
|
|
513
|
+
duration: bigint;
|
|
514
|
+
deadline: bigint;
|
|
515
|
+
multiLender: boolean;
|
|
516
|
+
nonce: bigint;
|
|
517
|
+
}>;
|
|
518
|
+
debtAssetsFlat: Asset[];
|
|
519
|
+
interestAssetsFlat: Asset[];
|
|
520
|
+
collateralAssetsFlat: Asset[];
|
|
521
|
+
borrowerSigs: string[][];
|
|
522
|
+
batchOffer: {
|
|
523
|
+
batchHash: string;
|
|
524
|
+
count: number;
|
|
525
|
+
lender: string;
|
|
526
|
+
startNonce: bigint;
|
|
527
|
+
};
|
|
528
|
+
lenderSig: string[];
|
|
529
|
+
bpsList: bigint[];
|
|
530
|
+
}): Call;
|
|
482
531
|
buildFillSignedOrder(order: SignedOrder, signature: string[], fillBps: bigint): Call;
|
|
483
532
|
buildCancelOrder(order: SignedOrder): Call;
|
|
484
533
|
buildCancelOrdersByNonce(minNonce: string): Call;
|
|
@@ -656,4 +705,4 @@ declare class StelaSdk {
|
|
|
656
705
|
constructor(opts: StelaSdkOptions);
|
|
657
706
|
}
|
|
658
707
|
|
|
659
|
-
export { ASSET_TYPE_ENUM, ASSET_TYPE_NAMES, ApiClient, type ApiClientOptions, type ApiDetailResponse, ApiError, type ApiListResponse, type Asset, type AssetRow, type AssetType, CHAIN_ID, type Call, EXPLORER_TX_URL, type Inscription, type InscriptionCancelledEvent, InscriptionClient, type InscriptionClientOptions, type InscriptionCreatedEvent, type InscriptionEventRow, type InscriptionLiquidatedEvent, type InscriptionParams, type InscriptionRepaidEvent, type InscriptionRow, type InscriptionSignedEvent, type InscriptionStatus, type ListInscriptionsParams, type LockerCall, LockerClient, type LockerInfo, type LockerState, MAX_BPS, type Network, type OrderCancelledEvent, type OrderFilledEvent, type OrderSettledEvent, type OrdersBulkCancelledEvent, type RawEvent, SELECTORS, STATUS_LABELS, STELA_ADDRESS, type ShareBalance, ShareClient, type ShareClientOptions, type SharesRedeemedEvent, type SignedOrder, type StatusInput, type StelaEvent, StelaSdk, type StelaSdkOptions, type StoredInscription, type StoredSignature, TOKENS, type TokenInfo, type TransferSingleEvent, type TreasuryAsset, VALID_STATUSES, VIRTUAL_SHARE_OFFSET, addressesEqual, calculateFeeShares, computeStatus, convertToShares, deserializeSignature, findTokenByAddress, formatAddress, formatDuration, formatTimestamp, formatTokenValue, fromU256, getInscriptionOrderTypedData, getLendOfferTypedData, getTokensForNetwork, hashAssets, inscriptionIdToHex, normalizeAddress, parseAmount, parseEvent, parseEvents, resolveNetwork, scaleByPercentage, serializeSignature, sharesToPercentage, toHex, toU256 };
|
|
708
|
+
export { ASSET_TYPE_ENUM, ASSET_TYPE_NAMES, ApiClient, type ApiClientOptions, type ApiDetailResponse, ApiError, type ApiListResponse, type Asset, type AssetRow, type AssetType, type BatchEntry, CHAIN_ID, type Call, EXPLORER_TX_URL, type Inscription, type InscriptionCancelledEvent, InscriptionClient, type InscriptionClientOptions, type InscriptionCreatedEvent, type InscriptionEventRow, type InscriptionLiquidatedEvent, type InscriptionParams, type InscriptionRepaidEvent, type InscriptionRow, type InscriptionSignedEvent, type InscriptionStatus, type ListInscriptionsParams, type LockerCall, LockerClient, type LockerInfo, type LockerState, MAX_BPS, type Network, type OrderCancelledEvent, type OrderFilledEvent, type OrderSettledEvent, type OrdersBulkCancelledEvent, type RawEvent, SELECTORS, STATUS_LABELS, STELA_ADDRESS, type ShareBalance, ShareClient, type ShareClientOptions, type SharesRedeemedEvent, type SignedOrder, type StatusInput, type StelaEvent, StelaSdk, type StelaSdkOptions, type StoredInscription, type StoredSignature, TOKENS, type TokenInfo, type TransferSingleEvent, type TreasuryAsset, VALID_STATUSES, VIRTUAL_SHARE_OFFSET, addressesEqual, calculateFeeShares, computeStatus, convertToShares, deserializeSignature, findTokenByAddress, formatAddress, formatDuration, formatTimestamp, formatTokenValue, fromU256, getBatchLendOfferTypedData, getInscriptionOrderTypedData, getLendOfferTypedData, getTokensForNetwork, hashAssets, hashBatchEntries, inscriptionIdToHex, normalizeAddress, parseAmount, parseEvent, parseEvents, resolveNetwork, scaleByPercentage, serializeSignature, sharesToPercentage, toHex, toU256 };
|
package/dist/index.d.ts
CHANGED
|
@@ -371,6 +371,17 @@ declare function parseEvent(raw: RawEvent): StelaEvent | null;
|
|
|
371
371
|
/** Parse an array of raw events, skipping unrecognized ones. */
|
|
372
372
|
declare function parseEvents(rawEvents: RawEvent[]): StelaEvent[];
|
|
373
373
|
|
|
374
|
+
interface BatchEntry {
|
|
375
|
+
orderHash: string;
|
|
376
|
+
bps: bigint;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Hash an array of BatchEntry using Poseidon -- matches Cairo's hash_batch_entries().
|
|
380
|
+
*
|
|
381
|
+
* Format: Poseidon(count, order_hash_1, u256_hash(bps_1), order_hash_2, u256_hash(bps_2), ...)
|
|
382
|
+
* where u256_hash(bps) = Poseidon(U256_TYPE_HASH, low, high)
|
|
383
|
+
*/
|
|
384
|
+
declare function hashBatchEntries(entries: BatchEntry[]): string;
|
|
374
385
|
/**
|
|
375
386
|
* Hash an array of assets using Poseidon -- matches Cairo's hash_assets().
|
|
376
387
|
*
|
|
@@ -414,6 +425,17 @@ declare function getLendOfferTypedData(params: {
|
|
|
414
425
|
nonce: bigint;
|
|
415
426
|
chainId: string;
|
|
416
427
|
}): TypedData;
|
|
428
|
+
/**
|
|
429
|
+
* Build SNIP-12 TypedData for a lender's BatchLendOffer.
|
|
430
|
+
* The lender signs this off-chain to accept multiple orders atomically.
|
|
431
|
+
*/
|
|
432
|
+
declare function getBatchLendOfferTypedData(params: {
|
|
433
|
+
batchHash: string;
|
|
434
|
+
count: number;
|
|
435
|
+
lender: string;
|
|
436
|
+
startNonce: bigint;
|
|
437
|
+
chainId: string;
|
|
438
|
+
}): TypedData;
|
|
417
439
|
|
|
418
440
|
/**
|
|
419
441
|
* Serialize a starknet.js signature (Signature type) for storage in D1.
|
|
@@ -479,6 +501,33 @@ declare class InscriptionClient {
|
|
|
479
501
|
};
|
|
480
502
|
lenderSig: string[];
|
|
481
503
|
}): Call;
|
|
504
|
+
buildBatchSettle(params: {
|
|
505
|
+
orders: Array<{
|
|
506
|
+
borrower: string;
|
|
507
|
+
debtHash: string;
|
|
508
|
+
interestHash: string;
|
|
509
|
+
collateralHash: string;
|
|
510
|
+
debtCount: number;
|
|
511
|
+
interestCount: number;
|
|
512
|
+
collateralCount: number;
|
|
513
|
+
duration: bigint;
|
|
514
|
+
deadline: bigint;
|
|
515
|
+
multiLender: boolean;
|
|
516
|
+
nonce: bigint;
|
|
517
|
+
}>;
|
|
518
|
+
debtAssetsFlat: Asset[];
|
|
519
|
+
interestAssetsFlat: Asset[];
|
|
520
|
+
collateralAssetsFlat: Asset[];
|
|
521
|
+
borrowerSigs: string[][];
|
|
522
|
+
batchOffer: {
|
|
523
|
+
batchHash: string;
|
|
524
|
+
count: number;
|
|
525
|
+
lender: string;
|
|
526
|
+
startNonce: bigint;
|
|
527
|
+
};
|
|
528
|
+
lenderSig: string[];
|
|
529
|
+
bpsList: bigint[];
|
|
530
|
+
}): Call;
|
|
482
531
|
buildFillSignedOrder(order: SignedOrder, signature: string[], fillBps: bigint): Call;
|
|
483
532
|
buildCancelOrder(order: SignedOrder): Call;
|
|
484
533
|
buildCancelOrdersByNonce(minNonce: string): Call;
|
|
@@ -656,4 +705,4 @@ declare class StelaSdk {
|
|
|
656
705
|
constructor(opts: StelaSdkOptions);
|
|
657
706
|
}
|
|
658
707
|
|
|
659
|
-
export { ASSET_TYPE_ENUM, ASSET_TYPE_NAMES, ApiClient, type ApiClientOptions, type ApiDetailResponse, ApiError, type ApiListResponse, type Asset, type AssetRow, type AssetType, CHAIN_ID, type Call, EXPLORER_TX_URL, type Inscription, type InscriptionCancelledEvent, InscriptionClient, type InscriptionClientOptions, type InscriptionCreatedEvent, type InscriptionEventRow, type InscriptionLiquidatedEvent, type InscriptionParams, type InscriptionRepaidEvent, type InscriptionRow, type InscriptionSignedEvent, type InscriptionStatus, type ListInscriptionsParams, type LockerCall, LockerClient, type LockerInfo, type LockerState, MAX_BPS, type Network, type OrderCancelledEvent, type OrderFilledEvent, type OrderSettledEvent, type OrdersBulkCancelledEvent, type RawEvent, SELECTORS, STATUS_LABELS, STELA_ADDRESS, type ShareBalance, ShareClient, type ShareClientOptions, type SharesRedeemedEvent, type SignedOrder, type StatusInput, type StelaEvent, StelaSdk, type StelaSdkOptions, type StoredInscription, type StoredSignature, TOKENS, type TokenInfo, type TransferSingleEvent, type TreasuryAsset, VALID_STATUSES, VIRTUAL_SHARE_OFFSET, addressesEqual, calculateFeeShares, computeStatus, convertToShares, deserializeSignature, findTokenByAddress, formatAddress, formatDuration, formatTimestamp, formatTokenValue, fromU256, getInscriptionOrderTypedData, getLendOfferTypedData, getTokensForNetwork, hashAssets, inscriptionIdToHex, normalizeAddress, parseAmount, parseEvent, parseEvents, resolveNetwork, scaleByPercentage, serializeSignature, sharesToPercentage, toHex, toU256 };
|
|
708
|
+
export { ASSET_TYPE_ENUM, ASSET_TYPE_NAMES, ApiClient, type ApiClientOptions, type ApiDetailResponse, ApiError, type ApiListResponse, type Asset, type AssetRow, type AssetType, type BatchEntry, CHAIN_ID, type Call, EXPLORER_TX_URL, type Inscription, type InscriptionCancelledEvent, InscriptionClient, type InscriptionClientOptions, type InscriptionCreatedEvent, type InscriptionEventRow, type InscriptionLiquidatedEvent, type InscriptionParams, type InscriptionRepaidEvent, type InscriptionRow, type InscriptionSignedEvent, type InscriptionStatus, type ListInscriptionsParams, type LockerCall, LockerClient, type LockerInfo, type LockerState, MAX_BPS, type Network, type OrderCancelledEvent, type OrderFilledEvent, type OrderSettledEvent, type OrdersBulkCancelledEvent, type RawEvent, SELECTORS, STATUS_LABELS, STELA_ADDRESS, type ShareBalance, ShareClient, type ShareClientOptions, type SharesRedeemedEvent, type SignedOrder, type StatusInput, type StelaEvent, StelaSdk, type StelaSdkOptions, type StoredInscription, type StoredSignature, TOKENS, type TokenInfo, type TransferSingleEvent, type TreasuryAsset, VALID_STATUSES, VIRTUAL_SHARE_OFFSET, addressesEqual, calculateFeeShares, computeStatus, convertToShares, deserializeSignature, findTokenByAddress, formatAddress, formatDuration, formatTimestamp, formatTokenValue, fromU256, getBatchLendOfferTypedData, getInscriptionOrderTypedData, getLendOfferTypedData, getTokensForNetwork, hashAssets, hashBatchEntries, inscriptionIdToHex, normalizeAddress, parseAmount, parseEvent, parseEvents, resolveNetwork, scaleByPercentage, serializeSignature, sharesToPercentage, toHex, toU256 };
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var STATUS_LABELS = {
|
|
|
22
22
|
|
|
23
23
|
// src/constants/addresses.ts
|
|
24
24
|
var STELA_ADDRESS = {
|
|
25
|
-
sepolia: "
|
|
25
|
+
sepolia: "0x012998e49cc8205d0bb56b5c10202bd32994091b1cacdb7bcbd03dc6781d4974",
|
|
26
26
|
mainnet: "0x0"
|
|
27
27
|
};
|
|
28
28
|
var VALID_NETWORKS = ["sepolia", "mainnet"];
|
|
@@ -426,6 +426,17 @@ function parseEvents(rawEvents) {
|
|
|
426
426
|
}
|
|
427
427
|
return results;
|
|
428
428
|
}
|
|
429
|
+
var U256_TYPE_HASH = "0x3b143be38b811560b45593fb2a071ec4ddd0a020e10782be62ffe6f39e0e82c";
|
|
430
|
+
function hashBatchEntries(entries) {
|
|
431
|
+
const elements = [String(entries.length)];
|
|
432
|
+
for (const entry of entries) {
|
|
433
|
+
elements.push(entry.orderHash);
|
|
434
|
+
const [low, high] = toU256(entry.bps);
|
|
435
|
+
const bpsHash = hash.computePoseidonHashOnElements([U256_TYPE_HASH, low, high]);
|
|
436
|
+
elements.push(bpsHash);
|
|
437
|
+
}
|
|
438
|
+
return hash.computePoseidonHashOnElements(elements);
|
|
439
|
+
}
|
|
429
440
|
function hashAssets(assets) {
|
|
430
441
|
const elements = [String(assets.length)];
|
|
431
442
|
for (const asset of assets) {
|
|
@@ -526,6 +537,35 @@ function getLendOfferTypedData(params) {
|
|
|
526
537
|
}
|
|
527
538
|
};
|
|
528
539
|
}
|
|
540
|
+
function getBatchLendOfferTypedData(params) {
|
|
541
|
+
return {
|
|
542
|
+
types: {
|
|
543
|
+
StarknetDomain: [
|
|
544
|
+
{ name: "name", type: "shortstring" },
|
|
545
|
+
{ name: "version", type: "shortstring" },
|
|
546
|
+
{ name: "chainId", type: "shortstring" },
|
|
547
|
+
{ name: "revision", type: "shortstring" }
|
|
548
|
+
],
|
|
549
|
+
BatchLendOffer: [
|
|
550
|
+
{ name: "batch_hash", type: "felt" },
|
|
551
|
+
{ name: "count", type: "u128" },
|
|
552
|
+
{ name: "lender", type: "ContractAddress" },
|
|
553
|
+
{ name: "start_nonce", type: "felt" }
|
|
554
|
+
]
|
|
555
|
+
},
|
|
556
|
+
primaryType: "BatchLendOffer",
|
|
557
|
+
domain: {
|
|
558
|
+
...STELA_DOMAIN,
|
|
559
|
+
chainId: params.chainId
|
|
560
|
+
},
|
|
561
|
+
message: {
|
|
562
|
+
batch_hash: params.batchHash,
|
|
563
|
+
count: params.count.toString(),
|
|
564
|
+
lender: params.lender,
|
|
565
|
+
start_nonce: params.startNonce.toString()
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
}
|
|
529
569
|
|
|
530
570
|
// src/offchain/signature.ts
|
|
531
571
|
function serializeSignature(sig) {
|
|
@@ -720,6 +760,28 @@ var stela_default = [
|
|
|
720
760
|
}
|
|
721
761
|
]
|
|
722
762
|
},
|
|
763
|
+
{
|
|
764
|
+
type: "struct",
|
|
765
|
+
name: "stela::snip12::BatchLendOffer",
|
|
766
|
+
members: [
|
|
767
|
+
{
|
|
768
|
+
name: "batch_hash",
|
|
769
|
+
type: "core::felt252"
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
name: "count",
|
|
773
|
+
type: "core::integer::u32"
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
name: "lender",
|
|
777
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
name: "start_nonce",
|
|
781
|
+
type: "core::felt252"
|
|
782
|
+
}
|
|
783
|
+
]
|
|
784
|
+
},
|
|
723
785
|
{
|
|
724
786
|
type: "struct",
|
|
725
787
|
name: "stela::types::signed_order::SignedOrder",
|
|
@@ -932,6 +994,46 @@ var stela_default = [
|
|
|
932
994
|
outputs: [],
|
|
933
995
|
state_mutability: "external"
|
|
934
996
|
},
|
|
997
|
+
{
|
|
998
|
+
type: "function",
|
|
999
|
+
name: "batch_settle",
|
|
1000
|
+
inputs: [
|
|
1001
|
+
{
|
|
1002
|
+
name: "orders",
|
|
1003
|
+
type: "core::array::Array::<stela::snip12::InscriptionOrder>"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
name: "debt_assets_flat",
|
|
1007
|
+
type: "core::array::Array::<stela::types::asset::Asset>"
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
name: "interest_assets_flat",
|
|
1011
|
+
type: "core::array::Array::<stela::types::asset::Asset>"
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
name: "collateral_assets_flat",
|
|
1015
|
+
type: "core::array::Array::<stela::types::asset::Asset>"
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
name: "borrower_sigs",
|
|
1019
|
+
type: "core::array::Array::<core::array::Array::<core::felt252>>"
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
name: "batch_offer",
|
|
1023
|
+
type: "stela::snip12::BatchLendOffer"
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
name: "lender_sig",
|
|
1027
|
+
type: "core::array::Array::<core::felt252>"
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
name: "bps_list",
|
|
1031
|
+
type: "core::array::Array::<core::integer::u256>"
|
|
1032
|
+
}
|
|
1033
|
+
],
|
|
1034
|
+
outputs: [],
|
|
1035
|
+
state_mutability: "external"
|
|
1036
|
+
},
|
|
935
1037
|
{
|
|
936
1038
|
type: "function",
|
|
937
1039
|
name: "fill_signed_order",
|
|
@@ -2449,6 +2551,44 @@ var InscriptionClient = class {
|
|
|
2449
2551
|
];
|
|
2450
2552
|
return { contractAddress: this.address, entrypoint: "settle", calldata };
|
|
2451
2553
|
}
|
|
2554
|
+
buildBatchSettle(params) {
|
|
2555
|
+
const calldata = [];
|
|
2556
|
+
calldata.push(String(params.orders.length));
|
|
2557
|
+
for (const order of params.orders) {
|
|
2558
|
+
calldata.push(
|
|
2559
|
+
order.borrower,
|
|
2560
|
+
order.debtHash,
|
|
2561
|
+
order.interestHash,
|
|
2562
|
+
order.collateralHash,
|
|
2563
|
+
String(order.debtCount),
|
|
2564
|
+
String(order.interestCount),
|
|
2565
|
+
String(order.collateralCount),
|
|
2566
|
+
order.duration.toString(),
|
|
2567
|
+
order.deadline.toString(),
|
|
2568
|
+
order.multiLender ? "1" : "0",
|
|
2569
|
+
order.nonce.toString()
|
|
2570
|
+
);
|
|
2571
|
+
}
|
|
2572
|
+
calldata.push(...serializeAssets(params.debtAssetsFlat));
|
|
2573
|
+
calldata.push(...serializeAssets(params.interestAssetsFlat));
|
|
2574
|
+
calldata.push(...serializeAssets(params.collateralAssetsFlat));
|
|
2575
|
+
calldata.push(String(params.borrowerSigs.length));
|
|
2576
|
+
for (const sig of params.borrowerSigs) {
|
|
2577
|
+
calldata.push(String(sig.length), ...sig);
|
|
2578
|
+
}
|
|
2579
|
+
calldata.push(
|
|
2580
|
+
params.batchOffer.batchHash,
|
|
2581
|
+
String(params.batchOffer.count),
|
|
2582
|
+
params.batchOffer.lender,
|
|
2583
|
+
params.batchOffer.startNonce.toString()
|
|
2584
|
+
);
|
|
2585
|
+
calldata.push(String(params.lenderSig.length), ...params.lenderSig);
|
|
2586
|
+
calldata.push(String(params.bpsList.length));
|
|
2587
|
+
for (const bps of params.bpsList) {
|
|
2588
|
+
calldata.push(...toU256(bps));
|
|
2589
|
+
}
|
|
2590
|
+
return { contractAddress: this.address, entrypoint: "batch_settle", calldata };
|
|
2591
|
+
}
|
|
2452
2592
|
buildFillSignedOrder(order, signature, fillBps) {
|
|
2453
2593
|
const calldata = [
|
|
2454
2594
|
// SignedOrder struct fields
|
|
@@ -2896,6 +3036,6 @@ var StelaSdk = class {
|
|
|
2896
3036
|
}
|
|
2897
3037
|
};
|
|
2898
3038
|
|
|
2899
|
-
export { ASSET_TYPE_ENUM, ASSET_TYPE_NAMES, ApiClient, ApiError, CHAIN_ID, EXPLORER_TX_URL, InscriptionClient, LockerClient, MAX_BPS, SELECTORS, STATUS_LABELS, STELA_ADDRESS, ShareClient, StelaSdk, TOKENS, VALID_STATUSES, VIRTUAL_SHARE_OFFSET, addressesEqual, calculateFeeShares, computeStatus, convertToShares, deserializeSignature, findTokenByAddress, formatAddress, formatDuration, formatTimestamp, formatTokenValue, fromU256, getInscriptionOrderTypedData, getLendOfferTypedData, getTokensForNetwork, hashAssets, inscriptionIdToHex, normalizeAddress, parseAmount, parseEvent, parseEvents, resolveNetwork, scaleByPercentage, serializeSignature, sharesToPercentage, toHex, toU256 };
|
|
3039
|
+
export { ASSET_TYPE_ENUM, ASSET_TYPE_NAMES, ApiClient, ApiError, CHAIN_ID, EXPLORER_TX_URL, InscriptionClient, LockerClient, MAX_BPS, SELECTORS, STATUS_LABELS, STELA_ADDRESS, ShareClient, StelaSdk, TOKENS, VALID_STATUSES, VIRTUAL_SHARE_OFFSET, addressesEqual, calculateFeeShares, computeStatus, convertToShares, deserializeSignature, findTokenByAddress, formatAddress, formatDuration, formatTimestamp, formatTokenValue, fromU256, getBatchLendOfferTypedData, getInscriptionOrderTypedData, getLendOfferTypedData, getTokensForNetwork, hashAssets, hashBatchEntries, inscriptionIdToHex, normalizeAddress, parseAmount, parseEvent, parseEvents, resolveNetwork, scaleByPercentage, serializeSignature, sharesToPercentage, toHex, toU256 };
|
|
2900
3040
|
//# sourceMappingURL=index.js.map
|
|
2901
3041
|
//# sourceMappingURL=index.js.map
|