gondi 0.44.0 → 0.46.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.
@@ -1,7 +1,7 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
2
2
  import { getSdkApollo } from '../../clients/api/sdk';
3
3
  import { Wallet } from '../../clients/contracts';
4
- import { BnplOrderInput, BulkNftOrdersInput, CollectionOrderInput, CollectionSignedOfferInput, DealInput, ListListingsQueryVariables, ListLoansQueryVariables, ListOffersQueryVariables, NftOrderInput, SingleNftOrderInput, SingleNftSignedOfferInput, TraitOrderInput, TraitSignedOfferInput } from '../../generated/graphql';
4
+ import { BnplOrderInput, BulkNftOrdersInput, CollectionOrderInput, CollectionSignedOfferInput, DealInput, ListListingsQueryVariables, ListLoansQueryVariables, ListOffersQueryVariables, LoanOfferPublicationInput, NftOrderInput, RenegotiationOfferInput, SingleNftOfferInput, SingleNftOrderInput, SingleNftSignedOfferInput, TraitOrderInput, TraitSignedOfferInput } from '../../generated/graphql';
5
5
  import { OnStepChange } from '../../gondi';
6
6
  import { RenegotiationOffer } from '../../model';
7
7
  export type Props = {
@@ -19,7 +19,7 @@ export declare class Api {
19
19
  taker: import("../../generated/graphql").Scalars["Address"];
20
20
  }>, options?: {} | undefined) => Promise<import("../../generated/graphql").GetSaleCalldataQuery>;
21
21
  generateSingleNftOfferHash: (variables: import("../../generated/graphql").Exact<{
22
- offerInput: import("../../generated/graphql").SingleNftOfferInput;
22
+ offerInput: SingleNftOfferInput;
23
23
  }>, options?: {} | undefined) => Promise<import("../../generated/graphql").GenerateSingleNftOfferHashMutation>;
24
24
  generateCollectionOfferHash: (variables: import("../../generated/graphql").Exact<{
25
25
  offerInput: import("../../generated/graphql").CollectionOfferInput;
@@ -28,7 +28,7 @@ export declare class Api {
28
28
  offerInput: import("../../generated/graphql").TraitOfferInput;
29
29
  }>, options?: {} | undefined) => Promise<import("../../generated/graphql").GenerateTraitOfferHashMutation>;
30
30
  generateRenegotiationOfferHash: (variables: import("../../generated/graphql").Exact<{
31
- renegotiationInput: import("../../generated/graphql").RenegotiationOfferInput;
31
+ renegotiationInput: RenegotiationOfferInput;
32
32
  }>, options?: {} | undefined) => Promise<import("../../generated/graphql").GenerateRenegotiationOfferHashMutation>;
33
33
  nftIdBySlugTokenId: (variables: import("../../generated/graphql").Exact<{
34
34
  slug: import("../../generated/graphql").Scalars["String"];
@@ -106,7 +106,38 @@ export declare class Api {
106
106
  collectionId: import("../../generated/graphql").Scalars["Int"];
107
107
  }>, options?: {} | undefined) => Promise<import("../../generated/graphql").CollectionStepsByIdQuery>;
108
108
  constructor({ apiClient, wallet, onStepChange }: Props);
109
- saveSingleNftOffer(offerInput: SingleNftSignedOfferInput): Promise<{
109
+ /** Check competition before asking the wallet to sign; saving rechecks atomically. */
110
+ previewSingleNftPublication(offerInput: SingleNftOfferInput, publication: LoanOfferPublicationInput): Promise<{
111
+ __typename?: "LoanOfferCompetitionPreview";
112
+ complete: boolean;
113
+ qualifies: boolean;
114
+ reason?: string | null;
115
+ replacementIds: Array<string>;
116
+ references: Array<{
117
+ __typename?: "LoanOfferCompetitionReference";
118
+ optionId: string;
119
+ sourceIds: Array<string>;
120
+ requiredNetPrincipal: bigint;
121
+ maximumEaprNumerator: bigint;
122
+ maximumEaprDenominator: bigint;
123
+ }>;
124
+ }>;
125
+ previewRenegotiationPublication(renegotiationInput: RenegotiationOfferInput, publication: LoanOfferPublicationInput): Promise<{
126
+ __typename?: "LoanOfferCompetitionPreview";
127
+ complete: boolean;
128
+ qualifies: boolean;
129
+ reason?: string | null;
130
+ replacementIds: Array<string>;
131
+ references: Array<{
132
+ __typename?: "LoanOfferCompetitionReference";
133
+ optionId: string;
134
+ sourceIds: Array<string>;
135
+ requiredNetPrincipal: bigint;
136
+ maximumEaprNumerator: bigint;
137
+ maximumEaprDenominator: bigint;
138
+ }>;
139
+ }>;
140
+ saveSingleNftOffer(offerInput: SingleNftSignedOfferInput, publication?: LoanOfferPublicationInput): Promise<{
110
141
  aprBps: import("../../generated/graphql").Scalars["BigInt"];
111
142
  borrowerAddress: import("../../generated/graphql").Scalars["Address"];
112
143
  capacity: import("../../generated/graphql").Scalars["BigInt"];
@@ -262,7 +293,7 @@ export declare class Api {
262
293
  message: object;
263
294
  };
264
295
  }>;
265
- saveCollectionOffer(offerInput: CollectionSignedOfferInput): Promise<{
296
+ saveCollectionOffer(offerInput: CollectionSignedOfferInput, publication?: LoanOfferPublicationInput): Promise<{
266
297
  aprBps: import("../../generated/graphql").Scalars["BigInt"];
267
298
  borrowerAddress: import("../../generated/graphql").Scalars["Address"];
268
299
  capacity: import("../../generated/graphql").Scalars["BigInt"];
@@ -312,7 +343,7 @@ export declare class Api {
312
343
  nftCollateralAddress: `0x${string}`;
313
344
  nftCollateralTokenId: bigint;
314
345
  }>;
315
- saveRefinanceOffer(renegotiation: RenegotiationOffer, fallbackOffer?: SingleNftSignedOfferInput): Promise<{
346
+ saveRefinanceOffer(renegotiation: RenegotiationOffer, fallbackOffer?: SingleNftSignedOfferInput, publication?: LoanOfferPublicationInput): Promise<{
316
347
  id: string;
317
348
  loanId: import("../../generated/graphql").Scalars["String"];
318
349
  duration: import("../../generated/graphql").Scalars["BigInt"];
@@ -13,6 +13,7 @@ export declare function getSdkApollo<C>(client: ApolloClient<C>, onStepChange?:
13
13
  }>, options?: {} | undefined): Promise<import("../../generated/graphql").GenerateCollectionOfferHashMutation>;
14
14
  saveCollectionOffer(variables: import("../../generated/graphql").Exact<{
15
15
  offer: import("../../generated/graphql").CollectionSignedOfferInput;
16
+ publication?: import("../../generated/graphql").InputMaybe<import("../../generated/graphql").LoanOfferPublicationInput>;
16
17
  }>, options?: {} | undefined): Promise<import("../../generated/graphql").SaveCollectionOfferMutation>;
17
18
  hideOffer(variables: import("../../generated/graphql").Exact<{
18
19
  contract: import("../../generated/graphql").Scalars["Address"];
@@ -27,6 +28,7 @@ export declare function getSdkApollo<C>(client: ApolloClient<C>, onStepChange?:
27
28
  }>, options?: {} | undefined): Promise<import("../../generated/graphql").GenerateSingleNftOfferHashMutation>;
28
29
  saveSingleNftOffer(variables: import("../../generated/graphql").Exact<{
29
30
  offer: import("../../generated/graphql").SingleNftSignedOfferInput;
31
+ publication?: import("../../generated/graphql").InputMaybe<import("../../generated/graphql").LoanOfferPublicationInput>;
30
32
  }>, options?: {} | undefined): Promise<import("../../generated/graphql").SaveSingleNftOfferMutation>;
31
33
  generateTraitOfferHash(variables: import("../../generated/graphql").Exact<{
32
34
  offerInput: import("../../generated/graphql").TraitOfferInput;
@@ -77,6 +79,7 @@ export declare function getSdkApollo<C>(client: ApolloClient<C>, onStepChange?:
77
79
  }>, options?: {} | undefined): Promise<import("../../generated/graphql").HideRenegotiationOfferMutation>;
78
80
  saveRenegotiationOffer(variables: import("../../generated/graphql").Exact<{
79
81
  renegotiation: import("../../generated/graphql").SignedRenegotiationOfferInput;
82
+ publication?: import("../../generated/graphql").InputMaybe<import("../../generated/graphql").LoanOfferPublicationInput>;
80
83
  fallbackOffer?: import("../../generated/graphql").InputMaybe<import("../../generated/graphql").SingleNftSignedOfferInput>;
81
84
  }>, options?: {} | undefined): Promise<import("../../generated/graphql").SaveRenegotiationOfferMutation>;
82
85
  unhideRenegotiationOffer(variables: import("../../generated/graphql").Exact<{
@@ -165,5 +168,13 @@ export declare function getSdkApollo<C>(client: ApolloClient<C>, onStepChange?:
165
168
  nftId: import("../../generated/graphql").Scalars["Int"];
166
169
  taker: import("../../generated/graphql").Scalars["Address"];
167
170
  }>, options?: {} | undefined): Promise<import("../../generated/graphql").GetSaleCalldataQuery>;
171
+ previewItemLoanOfferCompetition(variables: import("../../generated/graphql").Exact<{
172
+ offerInput: import("../../generated/graphql").SingleNftOfferInput;
173
+ replacementIds?: import("../../generated/graphql").InputMaybe<Array<import("../../generated/graphql").Scalars["String"]> | import("../../generated/graphql").Scalars["String"]>;
174
+ }>, options?: {} | undefined): Promise<import("../../generated/graphql").PreviewItemLoanOfferCompetitionQuery>;
175
+ previewRenegotiationCompetition(variables: import("../../generated/graphql").Exact<{
176
+ renegotiationInput: import("../../generated/graphql").RenegotiationOfferInput;
177
+ replacementIds?: import("../../generated/graphql").InputMaybe<Array<import("../../generated/graphql").Scalars["String"]> | import("../../generated/graphql").Scalars["String"]>;
178
+ }>, options?: {} | undefined): Promise<import("../../generated/graphql").PreviewRenegotiationCompetitionQuery>;
168
179
  };
169
180
  export type Sdk = ReturnType<typeof getSdkApollo>;
@@ -9055,6 +9055,12 @@ export declare class MslV6 extends BaseContract<typeof multiSourceLoanAbiV6 | ty
9055
9055
  * a loan the borrower sends, `BORROWER_SIGNATURE_LIFETIME` when the borrower signs it.
9056
9056
  */
9057
9057
  private mapEmitLoanToMslEmitLoanArgs;
9058
+ /**
9059
+ * Shapes a `LoanEmitted` event as `emitLoan` returns it: the loan under its SDK id
9060
+ * (`<contract>.<loanId>`) with its contract address, its on-chain id, and the SDK ids
9061
+ * (`<contract>.<lender>.<offerId>`) of the offers its execution data spent.
9062
+ */
9063
+ private toEmittedLoan;
9058
9064
  emitLoan(emitArgs: EmitLoanArgs): Promise<{
9059
9065
  txHash: `0x${string}`;
9060
9066
  waitTxInBlock: () => Promise<{
@@ -9142,6 +9148,107 @@ export declare class MslV6 extends BaseContract<typeof multiSourceLoanAbiV6 | ty
9142
9148
  offerIds: string[];
9143
9149
  }>;
9144
9150
  }>;
9151
+ /**
9152
+ * Emits one loan per item of `emitArgs` in a single transaction, as one `emitLoan` call each
9153
+ * inside the contract's `multicall`, which reverts every loan when one of them fails.
9154
+ *
9155
+ * @remarks
9156
+ * `waitTxInBlock` resolves to `loans`, in the order of `emitArgs`, each shaped as `emitLoan`
9157
+ * returns it. Each item is paired with the `LoanEmitted` event of its collateral
9158
+ * (`nftCollateralAddress`, `tokenId`) rather than by position, so a result can never
9159
+ * describe another item's loan; two items with the same collateral, which cannot both be
9160
+ * emitted, would take their events in order. It throws when the transaction emitted a
9161
+ * different number of loans than it was sent, or none for an item's collateral.
9162
+ */
9163
+ emitLoans(emitArgs: EmitLoanArgs[]): Promise<{
9164
+ txHash: `0x${string}`;
9165
+ waitTxInBlock: () => Promise<{
9166
+ blobGasPrice?: bigint | undefined;
9167
+ blobGasUsed?: bigint | undefined;
9168
+ blockHash: Hash;
9169
+ blockNumber: bigint;
9170
+ blockTimestamp?: bigint | undefined;
9171
+ contractAddress: Address | null | undefined;
9172
+ cumulativeGasUsed: bigint;
9173
+ effectiveGasPrice: bigint;
9174
+ from: Address;
9175
+ gasUsed: bigint;
9176
+ logs: import("viem").Log<bigint, number, false>[];
9177
+ logsBloom: Hex;
9178
+ root?: Hash | undefined;
9179
+ status: "success" | "reverted";
9180
+ to: Address | null;
9181
+ transactionHash: Hash;
9182
+ transactionIndex: number;
9183
+ type: import("viem").TransactionType;
9184
+ loans: {
9185
+ loan: {
9186
+ contractAddress: `0x${string}`;
9187
+ borrower: `0x${string}`;
9188
+ nftCollateralTokenId: bigint;
9189
+ nftCollateralAddress: `0x${string}`;
9190
+ principalAddress: `0x${string}`;
9191
+ principalAmount: bigint;
9192
+ startTime: bigint;
9193
+ duration: bigint;
9194
+ tranche: readonly {
9195
+ loanId: bigint;
9196
+ floor: bigint;
9197
+ principalAmount: bigint;
9198
+ lender: `0x${string}`;
9199
+ accruedInterest: bigint;
9200
+ startTime: bigint;
9201
+ aprBps: bigint;
9202
+ }[];
9203
+ protocolFee: bigint;
9204
+ id: string;
9205
+ } | {
9206
+ contractAddress: `0x${string}`;
9207
+ borrower: `0x${string}`;
9208
+ nftCollateralTokenId: bigint;
9209
+ nftCollateralAddress: `0x${string}`;
9210
+ principalAddress: `0x${string}`;
9211
+ principalAmount: bigint;
9212
+ startTime: bigint;
9213
+ duration: bigint;
9214
+ tranche: readonly {
9215
+ loanId: bigint;
9216
+ floor: bigint;
9217
+ principalAmount: bigint;
9218
+ lender: `0x${string}`;
9219
+ accruedInterest: bigint;
9220
+ startTime: bigint;
9221
+ aprBps: bigint;
9222
+ }[];
9223
+ protocolFee: bigint;
9224
+ id: string;
9225
+ } | {
9226
+ contractAddress: `0x${string}`;
9227
+ borrower: `0x${string}`;
9228
+ nftCollateralTokenId: bigint;
9229
+ nftCollateralAddress: `0x${string}`;
9230
+ principalAddress: `0x${string}`;
9231
+ principalAmount: bigint;
9232
+ startTime: bigint;
9233
+ duration: bigint;
9234
+ tranche: readonly {
9235
+ loanId: bigint;
9236
+ floor: bigint;
9237
+ principalAmount: bigint;
9238
+ lender: `0x${string}`;
9239
+ accruedInterest: bigint;
9240
+ startTime: bigint;
9241
+ aprBps: bigint;
9242
+ }[];
9243
+ protocolFee: bigint;
9244
+ lenderRefinanceDisabled: boolean;
9245
+ id: string;
9246
+ };
9247
+ loanId: bigint;
9248
+ offerIds: string[];
9249
+ }[];
9250
+ }>;
9251
+ }>;
9145
9252
  revokeDelegationsAndEmitLoan({ delegations, emit, }: {
9146
9253
  delegations: Address[];
9147
9254
  emit: EmitLoanArgs;