gondi 0.43.1 → 0.45.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.
@@ -5,7 +5,7 @@ import { Auction } from './blockchain';
5
5
  import { Api, Props as ApiProps } from './clients/api';
6
6
  import { Contracts, GondiPublicClient, Wallet } from './clients/contracts';
7
7
  import { CrossCurrencyRenegotiationInput, CrossCurrencyRenegotiationQuote } from './clients/contracts/CrossCurrencyRenegotiation';
8
- import { CollectionOrderInput, DealInput, GenerateCollectionOfferHashMutation, MarketplaceEnum, NftOrderInput, OfferValidatorInput, SingleNftOrderInput, SingleNftSignedOfferInput, TokenStandardType, TraitOrderInput } from './generated/graphql';
8
+ import { CollectionOrderInput, DealInput, GenerateCollectionOfferHashMutation, LoanOfferPublicationInput, MarketplaceEnum, NftOrderInput, OfferValidatorInput, SingleNftOrderInput, SingleNftSignedOfferInput, TokenStandardType, TraitOrderInput } from './generated/graphql';
9
9
  import * as model from './model';
10
10
  import { NftStandard } from './model';
11
11
  import { BuyWithLoanInput, BuyWithLoanQuote } from './utils/buyWithLoan';
@@ -42,6 +42,14 @@ interface GondiProps {
42
42
  publicClient?: GondiPublicClient;
43
43
  apiClient?: ApiProps['apiClient'];
44
44
  onStepChange?: OnStepChange;
45
+ /**
46
+ * Skips the flagged-NFT lookup `emitLoan`, `revokeDelegationsAndEmitLoan`,
47
+ * `refinanceFromOffers`, `efficientRefinanceFromOffers` and
48
+ * `crossCurrencyRenegotiation` run before
49
+ * sending, saving an API call. Only for callers that already keep flagged
50
+ * NFTs out of those flows themselves, such as the GONDI web app.
51
+ */
52
+ skipFlaggedNftCheck?: boolean;
45
53
  }
46
54
  type Step = {
47
55
  type: 'signature';
@@ -60,12 +68,20 @@ type Step = {
60
68
  };
61
69
  export type OnStepChange = (step: Step) => Promise<void>;
62
70
  export declare class Gondi {
71
+ private pendingSingleNftPublications;
72
+ private pendingCollectionPublications;
73
+ private pendingRenegotiationPublications;
74
+ /** Retains bounded signed payloads while their API save is pending. */
75
+ private rememberPublication;
76
+ /** Binds signed terms and contract; excludes unsigned predecessors. */
77
+ private publicationKey;
63
78
  contracts: Contracts;
64
79
  wallet: Wallet;
65
80
  account: Account;
66
81
  bcClient: GondiPublicClient;
67
82
  apiClient: Api;
68
- constructor({ wallet, publicClient, apiClient, onStepChange }: GondiProps);
83
+ skipFlaggedNftCheck: boolean;
84
+ constructor({ wallet, publicClient, apiClient, onStepChange, skipFlaggedNftCheck, }: GondiProps);
69
85
  static create(props: GondiProps & {
70
86
  onStepChange: OnStepChange;
71
87
  }): Gondi;
@@ -88,7 +104,13 @@ export declare class Gondi {
88
104
  nonce: string;
89
105
  issuedAt?: string;
90
106
  }) => string;
91
- makeSingleNftOffer(offer: model.SingleNftOfferInput): Promise<{
107
+ /**
108
+ * Signs and saves an item offer.
109
+ * @param publication Optional unsigned admission metadata. Previews before signing
110
+ * and throws the backend rejection reason. Identical retries after failed saves
111
+ * reuse the signature; a successful save clears that pending signature.
112
+ */
113
+ makeSingleNftOffer(offer: model.SingleNftOfferInput, publication?: LoanOfferPublicationInput): Promise<{
92
114
  aprBps: import("./generated/graphql").Scalars["BigInt"];
93
115
  borrowerAddress: import("./generated/graphql").Scalars["Address"];
94
116
  capacity: import("./generated/graphql").Scalars["BigInt"];
@@ -114,10 +136,16 @@ export declare class Gondi {
114
136
  nftCollateralTokenId: bigint;
115
137
  }>;
116
138
  /** @internal */
117
- _makeSingleNftOffer(offer: model.SingleNftOfferInput, mslContractAddress: Address, skipSave: true): Promise<SingleNftSignedOfferInput>;
139
+ _makeSingleNftOffer(offer: model.SingleNftOfferInput, mslContractAddress: Address, skipSave: true, publication?: LoanOfferPublicationInput): Promise<SingleNftSignedOfferInput>;
118
140
  /** @internal */
119
- _makeSingleNftOffer(offer: model.SingleNftOfferInput, mslContractAddress?: Address, skipSave?: false): ReturnType<Api['saveSingleNftOffer']>;
120
- makeCollectionOffer(offer: model.CollectionOfferInput): Promise<{
141
+ _makeSingleNftOffer(offer: model.SingleNftOfferInput, mslContractAddress?: Address, skipSave?: false, publication?: LoanOfferPublicationInput): ReturnType<Api['saveSingleNftOffer']>;
142
+ /**
143
+ * Signs and saves a collection offer without an item preview.
144
+ * @param publication Optional unsigned admission metadata. Identical retries after
145
+ * failed saves reuse the signature; a successful save clears that pending signature.
146
+ * The backend evaluates collection offers independently for each item.
147
+ */
148
+ makeCollectionOffer(offer: model.CollectionOfferInput, publication?: LoanOfferPublicationInput): Promise<{
121
149
  aprBps: import("./generated/graphql").Scalars["BigInt"];
122
150
  borrowerAddress: import("./generated/graphql").Scalars["Address"];
123
151
  capacity: import("./generated/graphql").Scalars["BigInt"];
@@ -143,7 +171,7 @@ export declare class Gondi {
143
171
  nftCollateralTokenId: bigint;
144
172
  }>;
145
173
  /** @internal */
146
- _makeCollectionOffer(offer: model.CollectionOfferInput, mslContractAddress?: Address): Promise<{
174
+ _makeCollectionOffer(offer: model.CollectionOfferInput, mslContractAddress?: Address, publication?: LoanOfferPublicationInput): Promise<{
147
175
  aprBps: import("./generated/graphql").Scalars["BigInt"];
148
176
  borrowerAddress: import("./generated/graphql").Scalars["Address"];
149
177
  capacity: import("./generated/graphql").Scalars["BigInt"];
@@ -710,7 +738,13 @@ export declare class Gondi {
710
738
  id: bigint;
711
739
  contractAddress: Address;
712
740
  }): Promise<import("./generated/graphql").UnhideOfferMutation>;
713
- makeRefinanceOffer({ renegotiation, contractAddress, ...props }: MakeRefinanceOfferProps): Promise<{
741
+ /**
742
+ * Signs and saves a refinance offer, optionally with a matching fallback.
743
+ * @param props.publication Optional unsigned admission metadata. Previews before
744
+ * signing and throws the backend rejection reason. Identical retries after failed
745
+ * saves reuse both signatures; a successful save clears the pending payloads.
746
+ */
747
+ makeRefinanceOffer({ renegotiation, contractAddress, publication, ...props }: MakeRefinanceOfferProps): Promise<{
714
748
  id: string;
715
749
  loanId: import("./generated/graphql").Scalars["String"];
716
750
  duration: import("./generated/graphql").Scalars["BigInt"];
@@ -875,6 +909,12 @@ export declare class Gondi {
875
909
  }>;
876
910
  }>;
877
911
  offerExecutionFromOffers(offers: OfferFromExecutionOffer[], amounts?: bigint[]): EmitLoanArgs['offerExecution'];
912
+ /**
913
+ * Throws `FlaggedNftError` when the API flags the collateral NFT or an NFT it wraps.
914
+ * An NFT the API does not know throws `NOT_FOUND`, and an API that does not answer
915
+ * throws its own error: a loan is only sent once the API confirms the NFT is not flagged.
916
+ */
917
+ private assertNftNotFlagged;
878
918
  emitLoan(args: EmitLoanArgs): Promise<{
879
919
  txHash: `0x${string}`;
880
920
  waitTxInBlock: () => Promise<{
@@ -3637,6 +3677,7 @@ export declare class Gondi {
3637
3677
  type MakeOfferType = Omit<Awaited<ReturnType<Gondi['makeSingleNftOffer']>>, 'nftId'> | Omit<Awaited<ReturnType<Gondi['makeCollectionOffer']>>, 'collectionId'> | Omit<Awaited<ReturnType<Gondi['makeTraitOffer']>>, 'traitIds'>;
3638
3678
  type OfferFromExecutionOffer = OptionalNullable<MakeOfferType, 'borrowerAddress' | 'lenderAddress' | 'offerHash' | 'signature'>;
3639
3679
  type MakeRefinanceOfferProps = {
3680
+ publication?: LoanOfferPublicationInput;
3640
3681
  renegotiation: model.RenegotiationInput;
3641
3682
  contractAddress: Address;
3642
3683
  } & ({
@@ -1,3 +1,4 @@
1
+ export { FlaggedNftError } from './errors';
1
2
  export { Gondi } from './gondi';
2
3
  export { LoanStatusType, OfferStatus, OffersSortField, Ordering, MarketplaceEnum, TokenStandardType, } from './generated/graphql';
3
4
  export type { OnStepChange } from './gondi';
@@ -6,3 +7,4 @@ export type { CrossCurrencyRenegotiationInput, CrossCurrencyRenegotiationQuote,
6
7
  export type * as Types from './model';
7
8
  export { FULFILLED, REJECTED } from './utils/promises';
8
9
  export type { BuyWithLoanInput, BuyWithLoanQuote } from './utils/buyWithLoan';
10
+ export type { LoanOfferPublicationInput } from './generated/graphql';