gondi 0.45.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.
@@ -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;
@@ -43,7 +43,7 @@ interface GondiProps {
43
43
  apiClient?: ApiProps['apiClient'];
44
44
  onStepChange?: OnStepChange;
45
45
  /**
46
- * Skips the flagged-NFT lookup `emitLoan`, `revokeDelegationsAndEmitLoan`,
46
+ * Skips the flagged-NFT lookup `emitLoan`, `emitLoans`, `revokeDelegationsAndEmitLoan`,
47
47
  * `refinanceFromOffers`, `efficientRefinanceFromOffers` and
48
48
  * `crossCurrencyRenegotiation` run before
49
49
  * sending, saving an API call. Only for callers that already keep flagged
@@ -1045,6 +1045,109 @@ export declare class Gondi {
1045
1045
  offerId: string;
1046
1046
  }>;
1047
1047
  }>;
1048
+ /**
1049
+ * Emits several loans in one transaction: either every loan is emitted or none is.
1050
+ *
1051
+ * Every offer of every loan must belong to the same MultiSourceLoan contract, of version 3 or
1052
+ * later, and each NFT goes through the flagged-NFT check `emitLoan` runs before anything is sent.
1053
+ * `waitTxInBlock` resolves to `loans`, one per item and in the same order, each shaped as
1054
+ * `emitLoan` returns it.
1055
+ *
1056
+ * IMPLEMENTATION NOTE: each loan is an encoded `emitLoan` call inside the contract's
1057
+ * `multicall(bytes[])`, which `MultiSourceLoan` inherits from `Multicall`
1058
+ * (florida-contracts `src/lib/loans/MultiSourceLoan.sol`, `src/lib/Multicall.sol`). It
1059
+ * delegatecalls the calls in order, so `msg.sender` stays the borrower, and reverts the whole
1060
+ * transaction with `MulticallFailed(index, reason)` as soon as one of them fails.
1061
+ */
1062
+ emitLoans(loans: EmitLoanArgs[]): Promise<{
1063
+ txHash: `0x${string}`;
1064
+ waitTxInBlock: () => Promise<{
1065
+ blobGasPrice?: bigint | undefined;
1066
+ blobGasUsed?: bigint | undefined;
1067
+ blockHash: Hash;
1068
+ blockNumber: bigint;
1069
+ blockTimestamp?: bigint | undefined;
1070
+ contractAddress: Address | null | undefined;
1071
+ cumulativeGasUsed: bigint;
1072
+ effectiveGasPrice: bigint;
1073
+ from: Address;
1074
+ gasUsed: bigint;
1075
+ logs: import("viem").Log<bigint, number, false>[];
1076
+ logsBloom: Hex;
1077
+ root?: Hash | undefined;
1078
+ status: "success" | "reverted";
1079
+ to: Address | null;
1080
+ transactionHash: Hash;
1081
+ transactionIndex: number;
1082
+ type: import("viem").TransactionType;
1083
+ loans: {
1084
+ loan: {
1085
+ contractAddress: `0x${string}`;
1086
+ borrower: `0x${string}`;
1087
+ nftCollateralTokenId: bigint;
1088
+ nftCollateralAddress: `0x${string}`;
1089
+ principalAddress: `0x${string}`;
1090
+ principalAmount: bigint;
1091
+ startTime: bigint;
1092
+ duration: bigint;
1093
+ tranche: readonly {
1094
+ loanId: bigint;
1095
+ floor: bigint;
1096
+ principalAmount: bigint;
1097
+ lender: `0x${string}`;
1098
+ accruedInterest: bigint;
1099
+ startTime: bigint;
1100
+ aprBps: bigint;
1101
+ }[];
1102
+ protocolFee: bigint;
1103
+ id: string;
1104
+ } | {
1105
+ contractAddress: `0x${string}`;
1106
+ borrower: `0x${string}`;
1107
+ nftCollateralTokenId: bigint;
1108
+ nftCollateralAddress: `0x${string}`;
1109
+ principalAddress: `0x${string}`;
1110
+ principalAmount: bigint;
1111
+ startTime: bigint;
1112
+ duration: bigint;
1113
+ tranche: readonly {
1114
+ loanId: bigint;
1115
+ floor: bigint;
1116
+ principalAmount: bigint;
1117
+ lender: `0x${string}`;
1118
+ accruedInterest: bigint;
1119
+ startTime: bigint;
1120
+ aprBps: bigint;
1121
+ }[];
1122
+ protocolFee: bigint;
1123
+ id: string;
1124
+ } | {
1125
+ contractAddress: `0x${string}`;
1126
+ borrower: `0x${string}`;
1127
+ nftCollateralTokenId: bigint;
1128
+ nftCollateralAddress: `0x${string}`;
1129
+ principalAddress: `0x${string}`;
1130
+ principalAmount: bigint;
1131
+ startTime: bigint;
1132
+ duration: bigint;
1133
+ tranche: readonly {
1134
+ loanId: bigint;
1135
+ floor: bigint;
1136
+ principalAmount: bigint;
1137
+ lender: `0x${string}`;
1138
+ accruedInterest: bigint;
1139
+ startTime: bigint;
1140
+ aprBps: bigint;
1141
+ }[];
1142
+ protocolFee: bigint;
1143
+ lenderRefinanceDisabled: boolean;
1144
+ id: string;
1145
+ };
1146
+ loanId: bigint;
1147
+ offerIds: string[];
1148
+ }[];
1149
+ }>;
1150
+ }>;
1048
1151
  refinanceFromOffers({ loan, loanId, executionData, }: {
1049
1152
  loan: LoanToMslLoanType;
1050
1153
  loanId: bigint;