-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodel.ts
120 lines (104 loc) · 3.08 KB
/
model.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import { Address, Hash } from 'viem';
import { Signature } from '@/blockchain';
import {
CollectionOfferInput as ApiCollectionOfferInput,
CollectionSignedOfferInput,
LoanSortInput,
LoanStatusType,
MarketplaceEnum,
OffersSortInput,
OfferStatus,
RenegotiationOfferInput as ApiRenegotiationInput,
SignedRenegotiationOfferInput,
SingleNftOfferInput as ApiSingleNftOfferInput,
SingleNftSignedOfferInput,
TermsFilter,
UserFilter,
} from '@/generated/graphql';
import { Optional } from '@/utils/types';
type MaxSeniorRepaymentArg = {
maxSeniorRepayment: Exclude<ApiSingleNftOfferInput['maxSeniorRepayment'], null | undefined>;
};
export type SingleNftOfferInput = Optional<
ApiSingleNftOfferInput,
'borrowerAddress' | 'lenderAddress' | 'signerAddress' | 'offerValidators' | 'contractAddress'
> &
MaxSeniorRepaymentArg;
export type UnsignedSingleNftOffer = Omit<SingleNftSignedOfferInput, 'signature'> & {
nftCollateralAddress: Address;
nftCollateralTokenId: bigint;
};
export type SingleNftOffer = UnsignedSingleNftOffer &
SingleNftSignedOfferInput & {
signature: Hash;
} & MaxSeniorRepaymentArg;
export type CollectionOfferInput = Optional<
ApiCollectionOfferInput,
'borrowerAddress' | 'lenderAddress' | 'signerAddress' | 'offerValidators' | 'contractAddress'
> &
MaxSeniorRepaymentArg;
export type UnsignedCollectionOffer = Omit<
CollectionSignedOfferInput,
'signature' | 'collectionId'
> & {
nftCollateralAddress: Address;
};
export type CollectionOffer = UnsignedCollectionOffer & {
signature: Hash;
nftCollateralTokenId: 0n;
} & MaxSeniorRepaymentArg;
export type RenegotiationInput = Optional<
ApiRenegotiationInput,
'lenderAddress' | 'signerAddress'
> &
(
| {
trancheIndex: Exclude<ApiRenegotiationInput['trancheIndex'], null | undefined>;
targetPrincipal?: undefined;
}
| {
trancheIndex?: undefined;
targetPrincipal: Exclude<ApiRenegotiationInput['targetPrincipal'], null | undefined>;
}
);
export type UnsignedRenegotiationOffer = Omit<SignedRenegotiationOfferInput, 'signature'>;
export type RenegotiationOffer = UnsignedRenegotiationOffer & {
signature: Signature;
};
/** @ignore */
export const MAX_NUMBER =
115792089237316195423570985008687907853269984665640564039457584007913129639935n;
export type ListOffersProps = {
limit?: number;
cursor?: string | null;
sortBy?: OffersSortInput;
filterBy?: {
nft?: number;
onlySingleNftOffers?: boolean;
collection?: number;
onlyCollectionOffers?: boolean;
borrower?: Address;
lenders?: Address[];
status?: OfferStatus[];
};
};
export interface ListLoansProps {
limit?: number;
cursor?: string | null;
borrowers?: Address[];
collections?: number[];
nfts?: number[];
statuses?: LoanStatusType[];
sortBy?: LoanSortInput;
terms?: TermsFilter;
orderByStatuses?: boolean;
loansCurrencyAddress?: Address;
}
export type ListListingsProps = {
collections?: number[];
user?: UserFilter;
marketPlaces?: MarketplaceEnum[];
limit?: number;
cursor?: string | null;
};
export type NftStandard = 'ERC721' | 'ERC1155';