gondi 0.58.2 → 0.60.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.
@@ -699,7 +699,7 @@ export declare enum BlockchainEnum {
699
699
  export type BulkNftOrdersInput = {
700
700
  /** The maker's Seaport counter, which every order is built with. Optional: GONDI looks it up when it is missing. A signed order whose counter is not the maker's current one is rejected. */
701
701
  counter?: InputMaybe<Scalars['BigInt']>;
702
- /** Also lists each ask on OpenSea at the same price, signed with the same signature; public asks on Ethereum only. */
702
+ /** Also lists each ask on OpenSea at the same price, or at its `openSeaPrice`, signed with the same signature; public asks on Ethereum only. */
703
703
  listOnOpenSea?: Scalars['Boolean'];
704
704
  orders: Array<SingleNftOrderInput>;
705
705
  signature?: InputMaybe<Scalars['Signature']>;
@@ -5823,6 +5823,8 @@ export type SingleNftOrderInput = {
5823
5823
  expirationTime: Scalars['BigInt'];
5824
5824
  fees?: InputMaybe<Array<OrderFee>>;
5825
5825
  isAsk?: InputMaybe<Scalars['Boolean']>;
5826
+ /** The price of the ask's OpenSea listing when it differs from `price`, so the seller can receive as much on OpenSea after its higher fees. At least `price`. Only in a bulk order that lists on OpenSea. */
5827
+ openSeaPrice?: InputMaybe<Scalars['BigInt']>;
5826
5828
  price?: InputMaybe<Scalars['BigInt']>;
5827
5829
  signature?: InputMaybe<Scalars['Signature']>;
5828
5830
  startTime: Scalars['BigInt'];
@@ -114,6 +114,13 @@ export declare class Gondi {
114
114
  private pendingRenegotiationPublications;
115
115
  /** Retains bounded signed payloads while their API save is pending. */
116
116
  private rememberPublication;
117
+ /**
118
+ * Returns the signed payload still pending under `key`. Throws once
119
+ * `expirationTime` (seconds, part of the signed terms and so of `key`) has
120
+ * passed, dropping the payload: the same terms signed again would be expired
121
+ * too, and the API saves an expired offer that nobody can accept.
122
+ */
123
+ private pendingPublication;
117
124
  /** Binds signed terms and contract; excludes unsigned predecessors. */
118
125
  private publicationKey;
119
126
  contracts: Contracts;
@@ -147,9 +154,12 @@ export declare class Gondi {
147
154
  }) => string;
148
155
  /**
149
156
  * Signs and saves an item offer.
157
+ * A `lenderRefinanceDisabled` offer signs for MultiSourceLoan v3.2, the only version
158
+ * that signs the flag; any other offer signs for v3.1.
150
159
  * @param publication Optional unsigned admission metadata. Previews before signing
151
160
  * and throws the backend rejection reason. Identical retries after failed saves
152
- * reuse the signature; a successful save clears that pending signature.
161
+ * reuse the signature; a successful save clears it. Throws `Offer expired` once
162
+ * `expirationTime` has passed, before asking for a signature.
153
163
  */
154
164
  makeSingleNftOffer(offer: model.SingleNftOfferInput, publication?: LoanOfferPublicationInput): Promise<{
155
165
  aprBps: import("./generated/graphql").Scalars["BigInt"];
@@ -182,8 +192,11 @@ export declare class Gondi {
182
192
  _makeSingleNftOffer(offer: model.SingleNftOfferInput, mslContractAddress?: Address, skipSave?: false, publication?: LoanOfferPublicationInput): ReturnType<Api['saveSingleNftOffer']>;
183
193
  /**
184
194
  * Signs and saves a collection offer without an item preview.
195
+ * A `lenderRefinanceDisabled` offer signs for MultiSourceLoan v3.2, the only version
196
+ * that signs the flag; any other offer signs for v3.1.
185
197
  * @param publication Optional unsigned admission metadata. Identical retries after
186
- * failed saves reuse the signature; a successful save clears that pending signature.
198
+ * failed saves reuse the signature; a successful save clears it. Throws `Offer expired`
199
+ * once `expirationTime` has passed, before asking for a signature.
187
200
  * The backend evaluates collection offers independently for each item.
188
201
  */
189
202
  makeCollectionOffer(offer: model.CollectionOfferInput, publication?: LoanOfferPublicationInput): Promise<{
@@ -237,7 +250,11 @@ export declare class Gondi {
237
250
  nftCollateralAddress: `0x${string}`;
238
251
  nftCollateralTokenId: bigint;
239
252
  }>;
240
- /** A loan offer any NFT of the collection carrying every one of `offer.traitIds` can borrow against. */
253
+ /**
254
+ * A loan offer any NFT of the collection carrying every one of `offer.traitIds` can borrow against.
255
+ * A `lenderRefinanceDisabled` offer signs for MultiSourceLoan v3.2, the only version
256
+ * that signs the flag; any other offer signs for v3.1.
257
+ */
241
258
  makeTraitOffer(offer: model.TraitOfferInput): Promise<{
242
259
  aprBps: import("./generated/graphql").Scalars["BigInt"];
243
260
  borrowerAddress: import("./generated/graphql").Scalars["Address"];
@@ -325,6 +342,7 @@ export declare class Gondi {
325
342
  expirationTime: import("./generated/graphql").Scalars["BigInt"];
326
343
  fees?: import("./generated/graphql").InputMaybe<Array<import("./generated/graphql").OrderFee>>;
327
344
  isAsk?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]>;
345
+ openSeaPrice?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
328
346
  price?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
329
347
  signature: import("./generated/graphql").InputMaybe<`0x${string}`>;
330
348
  startTime: import("./generated/graphql").Scalars["BigInt"];
@@ -403,6 +421,7 @@ export declare class Gondi {
403
421
  expirationTime: import("./generated/graphql").Scalars["BigInt"];
404
422
  fees?: import("./generated/graphql").InputMaybe<Array<import("./generated/graphql").OrderFee>>;
405
423
  isAsk?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]>;
424
+ openSeaPrice?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
406
425
  price?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
407
426
  signature: import("./generated/graphql").InputMaybe<`0x${string}`>;
408
427
  startTime: import("./generated/graphql").Scalars["BigInt"];
@@ -481,6 +500,7 @@ export declare class Gondi {
481
500
  expirationTime: import("./generated/graphql").Scalars["BigInt"];
482
501
  fees?: import("./generated/graphql").InputMaybe<Array<import("./generated/graphql").OrderFee>>;
483
502
  isAsk?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]>;
503
+ openSeaPrice?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
484
504
  price?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
485
505
  signature: import("./generated/graphql").InputMaybe<`0x${string}`>;
486
506
  startTime: import("./generated/graphql").Scalars["BigInt"];
@@ -559,6 +579,7 @@ export declare class Gondi {
559
579
  expirationTime: import("./generated/graphql").Scalars["BigInt"];
560
580
  fees?: import("./generated/graphql").InputMaybe<Array<import("./generated/graphql").OrderFee>>;
561
581
  isAsk?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]>;
582
+ openSeaPrice?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
562
583
  price?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
563
584
  signature: import("./generated/graphql").InputMaybe<`0x${string}`>;
564
585
  startTime: import("./generated/graphql").Scalars["BigInt"];
@@ -637,6 +658,7 @@ export declare class Gondi {
637
658
  expirationTime: import("./generated/graphql").Scalars["BigInt"];
638
659
  fees?: import("./generated/graphql").InputMaybe<Array<import("./generated/graphql").OrderFee>>;
639
660
  isAsk?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]>;
661
+ openSeaPrice?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
640
662
  price?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
641
663
  signature: import("./generated/graphql").InputMaybe<`0x${string}`>;
642
664
  startTime: import("./generated/graphql").Scalars["BigInt"];
@@ -733,7 +755,9 @@ export declare class Gondi {
733
755
  * Publishes `orders` like `makeOrders` and lists each one on OpenSea too, under the same
734
756
  * signature. Public asks on Ethereum only; the owner must have approved OpenSea's conduit for
735
757
  * each collection. A refusal never touches the GONDI ask: `openSeaListings` holds one entry per
736
- * ask, with its `orderHash` once OpenSea took it, or the `error` saying why it did not.
758
+ * ask, with its `orderHash` once OpenSea took it, or the `error` saying why it did not. An
759
+ * order's `openSeaPrice`, at least its `price`, prices its OpenSea listing on its own, so the
760
+ * seller can receive there what they do on GONDI after OpenSea's higher fees.
737
761
  */
738
762
  makeOrdersOnOpenSea(orders: SingleNftOrderInput[]): Promise<{
739
763
  __typename?: "BulkNFTOrdersResult";
@@ -1021,7 +1045,8 @@ export declare class Gondi {
1021
1045
  * Signs and saves a refinance offer, optionally with a matching fallback.
1022
1046
  * @param props.publication Optional unsigned admission metadata. Previews before
1023
1047
  * signing and throws the backend rejection reason. Identical retries after failed
1024
- * saves reuse both signatures; a successful save clears the pending payloads.
1048
+ * saves reuse both signatures; a successful save clears them. Throws `Offer expired`
1049
+ * once `expirationTime` has passed, before asking for a signature.
1025
1050
  * @param props.private Shows the offer only to the loan's borrower and to the lender.
1026
1051
  * The API accepts it only for a principal worth at least the private minimum in USD
1027
1052
  * ($50k). It is not part of the signed struct. With `withFallbackOffer`, the fallback
@@ -1523,6 +1548,13 @@ export declare class Gondi {
1523
1548
  offerIds: string[];
1524
1549
  }>;
1525
1550
  }>;
1551
+ /**
1552
+ * Repays `loan` and emits its replacement from `executionData` in one flash-loan backed
1553
+ * transaction. The borrower signs the expiring execution data first and the repayment data,
1554
+ * which carries no nonce or expiry, last, so declining an earlier prompt never leaves a
1555
+ * repayment signature behind. Every read, the migrator nonce included, finishes before the
1556
+ * first prompt, so a failed read cannot strand a signature either.
1557
+ */
1526
1558
  efficientRefinanceFromOffers({ contractAddress, loan, loanId, executionData, }: {
1527
1559
  contractAddress: Address;
1528
1560
  loan: LoanToMslLoanType;
@@ -3129,10 +3161,16 @@ export declare class Gondi {
3129
3161
  }): Promise<boolean>;
3130
3162
  /**
3131
3163
  * The MultiSourceLoan address `makeSingleNftOffer`, `makeCollectionOffer` and
3132
- * `makeTraitOffer` sign for on the wallet's chain: the `to` a lender approves
3133
- * the principal for before publishing those offers.
3164
+ * `makeTraitOffer` sign for on the wallet's chain when the caller names none:
3165
+ * the `to` a lender approves the principal for before publishing those offers.
3166
+ * v3.2 is the only version whose signed `LoanOffer` carries
3167
+ * `lenderRefinanceDisabled`, so a flagged offer signs for it and throws on a
3168
+ * chain without a v3.2 deployment; any other offer, or no offer, signs for the
3169
+ * default contract.
3134
3170
  */
3135
- offerContractAddress(): `0x${string}`;
3171
+ offerContractAddress({ lenderRefinanceDisabled, }?: {
3172
+ lenderRefinanceDisabled?: boolean | null;
3173
+ }): `0x${string}`;
3136
3174
  private getDefaults;
3137
3175
  refinanceFullLoan({ offer, loan, loanId, }: {
3138
3176
  offer: model.RenegotiationOffer;
@@ -4106,6 +4144,49 @@ export declare class Gondi {
4106
4144
  getAuctionRemainingLockupSeconds({ auction, }: {
4107
4145
  auction: Pick<Auction, 'startTime' | 'loanAddress'>;
4108
4146
  }): Promise<number>;
4147
+ /**
4148
+ * The bid refund in `token` that the auction liquidator of the loan contract at `loanAddress`
4149
+ * holds for `bidder` (the wallet by default) because returning it on an outbid failed.
4150
+ * Only contract version 3.2 holds refunds; older versions always read 0.
4151
+ */
4152
+ getAuctionPendingRefund({ loanAddress, token, bidder, }: {
4153
+ loanAddress: Address;
4154
+ token: Address;
4155
+ bidder?: Address;
4156
+ }): Promise<bigint>;
4157
+ /**
4158
+ * Claims the wallet's bid refund in `token` from the auction liquidator of the loan contract at
4159
+ * `loanAddress`. Only contract version 3.2 holds refunds.
4160
+ */
4161
+ claimAuctionRefund({ loanAddress, token }: {
4162
+ loanAddress: Address;
4163
+ token: Address;
4164
+ }): Promise<{
4165
+ txHash: `0x${string}`;
4166
+ waitTxInBlock: () => Promise<{
4167
+ blobGasPrice?: bigint | undefined;
4168
+ blobGasUsed?: bigint | undefined;
4169
+ blockHash: Hash;
4170
+ blockNumber: bigint;
4171
+ blockTimestamp?: bigint | undefined;
4172
+ contractAddress: Address | null | undefined;
4173
+ cumulativeGasUsed: bigint;
4174
+ effectiveGasPrice: bigint;
4175
+ from: Address;
4176
+ gasUsed: bigint;
4177
+ logs: import("viem").Log<bigint, number, false>[];
4178
+ logsBloom: Hex;
4179
+ root?: Hash | undefined;
4180
+ status: "success" | "reverted";
4181
+ to: Address | null;
4182
+ transactionHash: Hash;
4183
+ transactionIndex: number;
4184
+ type: import("viem").TransactionType;
4185
+ bidder: `0x${string}`;
4186
+ asset: `0x${string}`;
4187
+ amount: bigint;
4188
+ }>;
4189
+ }>;
4109
4190
  /**
4110
4191
  * Get the owner of an ERC 721 token.
4111
4192
  */
@@ -1,4 +1,4 @@
1
- export { FlaggedNftError } from './errors';
1
+ export { CreateVaultError, FlaggedNftError } from './errors';
2
2
  export { Gondi } from './gondi';
3
3
  export { CollectionOrderType, LoanStatusType, OfferStatus, OffersSortField, Ordering, OrderMatchMode, OrderSide, OrderSortField, OrderStatusType, MarketplaceEnum, TokenStandardType, } from './generated/graphql';
4
4
  export type { OnStepChange, Punk721WrapState } from './gondi';
@@ -12,6 +12,8 @@ export declare const isEmptyCalldata: (calldata: HexString) => calldata is "0x";
12
12
  */
13
13
  export declare const assertTransactionSucceeded: (receipt: TransactionReceipt) => TransactionReceipt;
14
14
  type ReceiptWaiter = Pick<PublicClient, 'waitForTransactionReceipt'>;
15
+ /** Waits for the transaction's receipt and returns it, or throws when the transaction reverted. */
16
+ export declare const waitForSucceededReceipt: (client: ReceiptWaiter, txHash: Hash) => Promise<TransactionReceipt>;
15
17
  /** A sent transaction whose `waitTxInBlock` resolves with its receipt once it succeeds. */
16
18
  export declare const minedTransaction: (client: ReceiptWaiter, txHash: Hash) => {
17
19
  txHash: `0x${string}`;
@@ -1,5 +1,5 @@
1
1
  import { Address } from 'viem';
2
- import { LoanV4, LoanV5, LoanV6 } from '../blockchain';
2
+ import { LoanV4, LoanV5, LoanV6, LoanV8 } from '../blockchain';
3
3
  import * as model from '../model';
4
4
  import { Optional } from '../utils/types';
5
5
  export declare const BPS = 10000n;
@@ -25,7 +25,7 @@ export declare const renegotiationToMslRenegotiation: (renegotiation: model.Rene
25
25
  private?: import("../generated/graphql").Scalars["Boolean"] | undefined;
26
26
  signature: import("../blockchain").Signature;
27
27
  };
28
- export type LoanToMslLoanType = Optional<LoanV4, 'nftCollateralAddress'> | Optional<LoanV5, 'nftCollateralAddress'> | Optional<LoanV6, 'nftCollateralAddress'>;
28
+ export type LoanToMslLoanType = Optional<LoanV4, 'nftCollateralAddress'> | Optional<LoanV5, 'nftCollateralAddress'> | Optional<LoanV6, 'nftCollateralAddress'> | Optional<LoanV8, 'nftCollateralAddress'>;
29
29
  export declare const loanToMslLoan: (loan: LoanToMslLoanType) => {
30
30
  startTime: bigint;
31
31
  contractStartTime: bigint;
@@ -50,7 +50,7 @@ export declare const loanToMslLoan: (loan: LoanToMslLoanType) => {
50
50
  aprBps: bigint;
51
51
  }[];
52
52
  protocolFee: bigint;
53
- lenderRefinanceDisabled: unknown;
53
+ lenderRefinanceDisabled: boolean;
54
54
  borrower: `0x${string}`;
55
55
  nftCollateralTokenId: bigint;
56
56
  principalAddress: `0x${string}`;
@@ -80,7 +80,7 @@ export declare const loanToMslLoan: (loan: LoanToMslLoanType) => {
80
80
  aprBps: bigint;
81
81
  }[];
82
82
  protocolFee: bigint;
83
- lenderRefinanceDisabled: unknown;
83
+ lenderRefinanceDisabled: boolean;
84
84
  borrower: `0x${string}`;
85
85
  nftCollateralTokenId: bigint;
86
86
  principalAddress: `0x${string}`;
@@ -110,7 +110,37 @@ export declare const loanToMslLoan: (loan: LoanToMslLoanType) => {
110
110
  aprBps: bigint;
111
111
  }[];
112
112
  protocolFee: bigint;
113
- lenderRefinanceDisabled: unknown;
113
+ lenderRefinanceDisabled: boolean;
114
+ borrower: `0x${string}`;
115
+ nftCollateralTokenId: bigint;
116
+ principalAddress: `0x${string}`;
117
+ principalAmount: bigint;
118
+ contractAddress: Address;
119
+ } | {
120
+ startTime: bigint;
121
+ contractStartTime: bigint;
122
+ duration: bigint;
123
+ nftCollateralAddress: `0x${string}`;
124
+ source: readonly {
125
+ loanId: bigint;
126
+ floor: bigint;
127
+ principalAmount: bigint;
128
+ lender: `0x${string}`;
129
+ accruedInterest: bigint;
130
+ startTime: bigint;
131
+ aprBps: bigint;
132
+ }[];
133
+ tranche: readonly {
134
+ loanId: bigint;
135
+ floor: bigint;
136
+ principalAmount: bigint;
137
+ lender: `0x${string}`;
138
+ accruedInterest: bigint;
139
+ startTime: bigint;
140
+ aprBps: bigint;
141
+ }[];
142
+ protocolFee: bigint;
143
+ lenderRefinanceDisabled: boolean;
114
144
  borrower: `0x${string}`;
115
145
  nftCollateralTokenId: bigint;
116
146
  principalAddress: `0x${string}`;
@@ -1,5 +1,12 @@
1
1
  export declare const toInteger: (bn: bigint | number) => number;
2
2
  export declare const bpsToPercentage: (bps: bigint | number) => number;
3
+ /**
4
+ * A percentage in whole basis points, dropping any fraction of a basis point.
5
+ *
6
+ * The product is rounded to 12 significant digits before the floor, since IEEE-754 lands many
7
+ * exact products just below the integer (`9.03 * 100 === 902.9999999999999`), which a bare floor
8
+ * would truncate one basis point low.
9
+ */
3
10
  export declare const perToBps: (percent: number) => number;
4
11
  export declare const bpsToPer: (bps: bigint | number) => number;
5
12
  export declare const floatToBigInt: (number: number, decimals: number) => bigint;