gondi 0.58.3 → 0.60.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.
@@ -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;
@@ -151,7 +158,8 @@ export declare class Gondi {
151
158
  * that signs the flag; any other offer signs for v3.1.
152
159
  * @param publication Optional unsigned admission metadata. Previews before signing
153
160
  * and throws the backend rejection reason. Identical retries after failed saves
154
- * 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.
155
163
  */
156
164
  makeSingleNftOffer(offer: model.SingleNftOfferInput, publication?: LoanOfferPublicationInput): Promise<{
157
165
  aprBps: import("./generated/graphql").Scalars["BigInt"];
@@ -187,7 +195,8 @@ export declare class Gondi {
187
195
  * A `lenderRefinanceDisabled` offer signs for MultiSourceLoan v3.2, the only version
188
196
  * that signs the flag; any other offer signs for v3.1.
189
197
  * @param publication Optional unsigned admission metadata. Identical retries after
190
- * 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.
191
200
  * The backend evaluates collection offers independently for each item.
192
201
  */
193
202
  makeCollectionOffer(offer: model.CollectionOfferInput, publication?: LoanOfferPublicationInput): Promise<{
@@ -333,6 +342,7 @@ export declare class Gondi {
333
342
  expirationTime: import("./generated/graphql").Scalars["BigInt"];
334
343
  fees?: import("./generated/graphql").InputMaybe<Array<import("./generated/graphql").OrderFee>>;
335
344
  isAsk?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]>;
345
+ openSeaPrice?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
336
346
  price?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
337
347
  signature: import("./generated/graphql").InputMaybe<`0x${string}`>;
338
348
  startTime: import("./generated/graphql").Scalars["BigInt"];
@@ -411,6 +421,7 @@ export declare class Gondi {
411
421
  expirationTime: import("./generated/graphql").Scalars["BigInt"];
412
422
  fees?: import("./generated/graphql").InputMaybe<Array<import("./generated/graphql").OrderFee>>;
413
423
  isAsk?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]>;
424
+ openSeaPrice?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
414
425
  price?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
415
426
  signature: import("./generated/graphql").InputMaybe<`0x${string}`>;
416
427
  startTime: import("./generated/graphql").Scalars["BigInt"];
@@ -489,6 +500,7 @@ export declare class Gondi {
489
500
  expirationTime: import("./generated/graphql").Scalars["BigInt"];
490
501
  fees?: import("./generated/graphql").InputMaybe<Array<import("./generated/graphql").OrderFee>>;
491
502
  isAsk?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]>;
503
+ openSeaPrice?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
492
504
  price?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
493
505
  signature: import("./generated/graphql").InputMaybe<`0x${string}`>;
494
506
  startTime: import("./generated/graphql").Scalars["BigInt"];
@@ -567,6 +579,7 @@ export declare class Gondi {
567
579
  expirationTime: import("./generated/graphql").Scalars["BigInt"];
568
580
  fees?: import("./generated/graphql").InputMaybe<Array<import("./generated/graphql").OrderFee>>;
569
581
  isAsk?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]>;
582
+ openSeaPrice?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
570
583
  price?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
571
584
  signature: import("./generated/graphql").InputMaybe<`0x${string}`>;
572
585
  startTime: import("./generated/graphql").Scalars["BigInt"];
@@ -645,6 +658,7 @@ export declare class Gondi {
645
658
  expirationTime: import("./generated/graphql").Scalars["BigInt"];
646
659
  fees?: import("./generated/graphql").InputMaybe<Array<import("./generated/graphql").OrderFee>>;
647
660
  isAsk?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]>;
661
+ openSeaPrice?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
648
662
  price?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["BigInt"]>;
649
663
  signature: import("./generated/graphql").InputMaybe<`0x${string}`>;
650
664
  startTime: import("./generated/graphql").Scalars["BigInt"];
@@ -741,7 +755,9 @@ export declare class Gondi {
741
755
  * Publishes `orders` like `makeOrders` and lists each one on OpenSea too, under the same
742
756
  * signature. Public asks on Ethereum only; the owner must have approved OpenSea's conduit for
743
757
  * each collection. A refusal never touches the GONDI ask: `openSeaListings` holds one entry per
744
- * 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.
745
761
  */
746
762
  makeOrdersOnOpenSea(orders: SingleNftOrderInput[]): Promise<{
747
763
  __typename?: "BulkNFTOrdersResult";
@@ -1029,7 +1045,8 @@ export declare class Gondi {
1029
1045
  * Signs and saves a refinance offer, optionally with a matching fallback.
1030
1046
  * @param props.publication Optional unsigned admission metadata. Previews before
1031
1047
  * signing and throws the backend rejection reason. Identical retries after failed
1032
- * 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.
1033
1050
  * @param props.private Shows the offer only to the loan's borrower and to the lender.
1034
1051
  * The API accepts it only for a principal worth at least the private minimum in USD
1035
1052
  * ($50k). It is not part of the signed struct. With `withFallbackOffer`, the fallback
@@ -1531,6 +1548,13 @@ export declare class Gondi {
1531
1548
  offerIds: string[];
1532
1549
  }>;
1533
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
+ */
1534
1558
  efficientRefinanceFromOffers({ contractAddress, loan, loanId, executionData, }: {
1535
1559
  contractAddress: Address;
1536
1560
  loan: LoanToMslLoanType;
@@ -4120,6 +4144,49 @@ export declare class Gondi {
4120
4144
  getAuctionRemainingLockupSeconds({ auction, }: {
4121
4145
  auction: Pick<Auction, 'startTime' | 'loanAddress'>;
4122
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
+ }>;
4123
4190
  /**
4124
4191
  * Get the owner of an ERC 721 token.
4125
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;