gondi 0.45.0 → 0.47.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.
@@ -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
@@ -51,16 +51,33 @@ interface GondiProps {
51
51
  */
52
52
  skipFlaggedNftCheck?: boolean;
53
53
  }
54
- type Step = {
55
- type: 'signature';
56
- primaryType: string;
57
- status: 'waiting' | 'success';
58
- } | {
54
+ /** Fields every transaction step carries, whatever its status. */
55
+ type TransactionStepBase = {
59
56
  type: 'transaction';
60
- status: 'waiting' | 'broadcasted' | 'success';
61
57
  to: Address;
62
58
  functionNameOrSelector: string;
59
+ /** Chain the wallet used to submit this transaction. */
60
+ chainId?: number;
61
+ };
62
+ /** A transaction step; narrowing on `status` tells which hashes it carries. */
63
+ type TransactionStep = TransactionStepBase & ({
64
+ status: 'waiting';
63
65
  } | {
66
+ status: 'broadcasted';
67
+ /** Hash the wallet broadcast. */
68
+ transactionHash: Hash;
69
+ } | {
70
+ status: 'success';
71
+ /** Hash of the mined receipt: a replacement's when the provider reports one. */
72
+ transactionHash: Hash;
73
+ /** Hash the wallet broadcast; equals `transactionHash` unless it was replaced. */
74
+ originalTransactionHash: Hash;
75
+ });
76
+ type Step = {
77
+ type: 'signature';
78
+ primaryType: string;
79
+ status: 'waiting' | 'success';
80
+ } | TransactionStep | {
64
81
  type: 'api';
65
82
  status: 'waiting' | 'success';
66
83
  mutationName: string;
@@ -743,6 +760,10 @@ export declare class Gondi {
743
760
  * @param props.publication Optional unsigned admission metadata. Previews before
744
761
  * signing and throws the backend rejection reason. Identical retries after failed
745
762
  * saves reuse both signatures; a successful save clears the pending payloads.
763
+ * @param props.private Shows the offer only to the loan's borrower and to the lender.
764
+ * The API accepts it only for a principal worth at least the private minimum in USD
765
+ * ($50k), and never together with `withFallbackOffer`, whose fallback would publish
766
+ * the same terms. It is not part of the signed struct.
746
767
  */
747
768
  makeRefinanceOffer({ renegotiation, contractAddress, publication, ...props }: MakeRefinanceOfferProps): Promise<{
748
769
  id: string;
@@ -761,6 +782,7 @@ export declare class Gondi {
761
782
  offerHash: import("./generated/graphql").Scalars["Hash"];
762
783
  feeAmount: import("./generated/graphql").Scalars["BigInt"];
763
784
  isAddNewTranche?: import("./generated/graphql").InputMaybe<import("./generated/graphql").Scalars["Boolean"]> | undefined;
785
+ private?: import("./generated/graphql").Scalars["Boolean"] | undefined;
764
786
  signature: import("./blockchain").Signature;
765
787
  } | {
766
788
  offerHash: `0x${string}`;
@@ -1045,6 +1067,109 @@ export declare class Gondi {
1045
1067
  offerId: string;
1046
1068
  }>;
1047
1069
  }>;
1070
+ /**
1071
+ * Emits several loans in one transaction: either every loan is emitted or none is.
1072
+ *
1073
+ * Every offer of every loan must belong to the same MultiSourceLoan contract, of version 3 or
1074
+ * later, and each NFT goes through the flagged-NFT check `emitLoan` runs before anything is sent.
1075
+ * `waitTxInBlock` resolves to `loans`, one per item and in the same order, each shaped as
1076
+ * `emitLoan` returns it.
1077
+ *
1078
+ * IMPLEMENTATION NOTE: each loan is an encoded `emitLoan` call inside the contract's
1079
+ * `multicall(bytes[])`, which `MultiSourceLoan` inherits from `Multicall`
1080
+ * (florida-contracts `src/lib/loans/MultiSourceLoan.sol`, `src/lib/Multicall.sol`). It
1081
+ * delegatecalls the calls in order, so `msg.sender` stays the borrower, and reverts the whole
1082
+ * transaction with `MulticallFailed(index, reason)` as soon as one of them fails.
1083
+ */
1084
+ emitLoans(loans: EmitLoanArgs[]): Promise<{
1085
+ txHash: `0x${string}`;
1086
+ waitTxInBlock: () => Promise<{
1087
+ blobGasPrice?: bigint | undefined;
1088
+ blobGasUsed?: bigint | undefined;
1089
+ blockHash: Hash;
1090
+ blockNumber: bigint;
1091
+ blockTimestamp?: bigint | undefined;
1092
+ contractAddress: Address | null | undefined;
1093
+ cumulativeGasUsed: bigint;
1094
+ effectiveGasPrice: bigint;
1095
+ from: Address;
1096
+ gasUsed: bigint;
1097
+ logs: import("viem").Log<bigint, number, false>[];
1098
+ logsBloom: Hex;
1099
+ root?: Hash | undefined;
1100
+ status: "success" | "reverted";
1101
+ to: Address | null;
1102
+ transactionHash: Hash;
1103
+ transactionIndex: number;
1104
+ type: import("viem").TransactionType;
1105
+ loans: {
1106
+ loan: {
1107
+ contractAddress: `0x${string}`;
1108
+ borrower: `0x${string}`;
1109
+ nftCollateralTokenId: bigint;
1110
+ nftCollateralAddress: `0x${string}`;
1111
+ principalAddress: `0x${string}`;
1112
+ principalAmount: bigint;
1113
+ startTime: bigint;
1114
+ duration: bigint;
1115
+ tranche: readonly {
1116
+ loanId: bigint;
1117
+ floor: bigint;
1118
+ principalAmount: bigint;
1119
+ lender: `0x${string}`;
1120
+ accruedInterest: bigint;
1121
+ startTime: bigint;
1122
+ aprBps: bigint;
1123
+ }[];
1124
+ protocolFee: bigint;
1125
+ id: string;
1126
+ } | {
1127
+ contractAddress: `0x${string}`;
1128
+ borrower: `0x${string}`;
1129
+ nftCollateralTokenId: bigint;
1130
+ nftCollateralAddress: `0x${string}`;
1131
+ principalAddress: `0x${string}`;
1132
+ principalAmount: bigint;
1133
+ startTime: bigint;
1134
+ duration: bigint;
1135
+ tranche: readonly {
1136
+ loanId: bigint;
1137
+ floor: bigint;
1138
+ principalAmount: bigint;
1139
+ lender: `0x${string}`;
1140
+ accruedInterest: bigint;
1141
+ startTime: bigint;
1142
+ aprBps: bigint;
1143
+ }[];
1144
+ protocolFee: bigint;
1145
+ id: string;
1146
+ } | {
1147
+ contractAddress: `0x${string}`;
1148
+ borrower: `0x${string}`;
1149
+ nftCollateralTokenId: bigint;
1150
+ nftCollateralAddress: `0x${string}`;
1151
+ principalAddress: `0x${string}`;
1152
+ principalAmount: bigint;
1153
+ startTime: bigint;
1154
+ duration: bigint;
1155
+ tranche: readonly {
1156
+ loanId: bigint;
1157
+ floor: bigint;
1158
+ principalAmount: bigint;
1159
+ lender: `0x${string}`;
1160
+ accruedInterest: bigint;
1161
+ startTime: bigint;
1162
+ aprBps: bigint;
1163
+ }[];
1164
+ protocolFee: bigint;
1165
+ lenderRefinanceDisabled: boolean;
1166
+ id: string;
1167
+ };
1168
+ loanId: bigint;
1169
+ offerIds: string[];
1170
+ }[];
1171
+ }>;
1172
+ }>;
1048
1173
  refinanceFromOffers({ loan, loanId, executionData, }: {
1049
1174
  loan: LoanToMslLoanType;
1050
1175
  loanId: bigint;
@@ -3686,18 +3811,21 @@ type MakeRefinanceOfferProps = {
3686
3811
  principalAddress?: never;
3687
3812
  nftId?: never;
3688
3813
  maxSeniorRepayment?: never;
3814
+ private?: boolean;
3689
3815
  } | {
3690
3816
  skipSignature: true;
3691
3817
  withFallbackOffer?: never;
3692
3818
  principalAddress?: never;
3693
3819
  nftId?: never;
3694
3820
  maxSeniorRepayment?: never;
3821
+ private?: boolean;
3695
3822
  } | {
3696
3823
  skipSignature?: never;
3697
3824
  withFallbackOffer: true;
3698
3825
  principalAddress: Address;
3699
3826
  nftId: number;
3700
3827
  maxSeniorRepayment?: bigint;
3828
+ private?: never;
3701
3829
  });
3702
3830
  export type CreateVaultNfts = {
3703
3831
  collection: Address;
@@ -22,6 +22,7 @@ export declare const renegotiationToMslRenegotiation: (renegotiation: model.Rene
22
22
  offerHash: import("../generated/graphql").Scalars["Hash"];
23
23
  feeAmount: import("../generated/graphql").Scalars["BigInt"];
24
24
  isAddNewTranche?: import("../generated/graphql").InputMaybe<import("../generated/graphql").Scalars["Boolean"]> | undefined;
25
+ private?: import("../generated/graphql").Scalars["Boolean"] | undefined;
25
26
  signature: import("../blockchain").Signature;
26
27
  };
27
28
  export type LoanToMslLoanType = Optional<LoanV4, 'nftCollateralAddress'> | Optional<LoanV5, 'nftCollateralAddress'> | Optional<LoanV6, 'nftCollateralAddress'>;