@coinlist-co/react 0.3.0 → 0.4.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.
- package/dist/{RequirementItem-BvwsFu9e.d.cts → RequirementItem-B-MvcxSr.d.cts} +3 -3
- package/dist/{RequirementItem-BpkJQep8.d.ts → RequirementItem-DcYot2uC.d.ts} +3 -3
- package/dist/{chunk-IDCROXPS.js → chunk-EHZ6PIGN.js} +6 -4
- package/dist/chunk-EHZ6PIGN.js.map +1 -0
- package/dist/chunk-NC45IO63.js +777 -0
- package/dist/chunk-NC45IO63.js.map +1 -0
- package/dist/chunk-RIFATQB5.js +257 -0
- package/dist/chunk-RIFATQB5.js.map +1 -0
- package/dist/chunk-UGJUTRXC.js +304 -0
- package/dist/chunk-UGJUTRXC.js.map +1 -0
- package/dist/client/components/index.cjs +60 -59
- package/dist/client/components/index.cjs.map +1 -1
- package/dist/client/components/index.d.cts +40 -22
- package/dist/client/components/index.d.ts +40 -22
- package/dist/client/components/index.js +34 -62
- package/dist/client/components/index.js.map +1 -1
- package/dist/client/core/index.cjs +308 -222
- package/dist/client/core/index.cjs.map +1 -1
- package/dist/client/core/index.d.cts +4 -4
- package/dist/client/core/index.d.ts +4 -4
- package/dist/client/core/index.js +14 -14
- package/dist/client/hooks/index.cjs +87 -13
- package/dist/client/hooks/index.cjs.map +1 -1
- package/dist/client/hooks/index.d.cts +102 -9
- package/dist/client/hooks/index.d.ts +102 -9
- package/dist/client/hooks/index.js +9 -9
- package/dist/client/index.cjs +465 -237
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +7 -8
- package/dist/client/index.d.ts +7 -8
- package/dist/client/index.js +24 -18
- package/dist/{coinlist-client-B_dJkbwB.d.ts → coinlist-client-BSxpqylo.d.ts} +13 -138
- package/dist/{coinlist-client-DBKa6j3f.d.cts → coinlist-client-Cah5c_aF.d.cts} +13 -138
- package/dist/participation-DMMEDxON.d.cts +185 -0
- package/dist/participation-E-bT-GXJ.d.ts +185 -0
- package/dist/{requirement-CxbdY8l4.d.cts → requirement-XWT0T_zO.d.cts} +5 -2
- package/dist/{requirement-fJsQ3f9_.d.ts → requirement-XWT0T_zO.d.ts} +5 -2
- package/dist/server/index.cjs +519 -14
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +73 -4
- package/dist/server/index.d.ts +73 -4
- package/dist/server/index.js +116 -20
- package/dist/server/index.js.map +1 -1
- package/dist/useCoinListRequirements-B5-ZPOMz.d.ts +80 -0
- package/dist/useCoinListRequirements-Cuc32Tqw.d.cts +80 -0
- package/package.json +1 -1
- package/dist/chunk-GRVV7NLV.js +0 -282
- package/dist/chunk-GRVV7NLV.js.map +0 -1
- package/dist/chunk-IADBIDY6.js +0 -76
- package/dist/chunk-IADBIDY6.js.map +0 -1
- package/dist/chunk-IDCROXPS.js.map +0 -1
- package/dist/chunk-P4DTIPEX.js +0 -623
- package/dist/chunk-P4DTIPEX.js.map +0 -1
- package/dist/chunk-V5M7SA3C.js +0 -161
- package/dist/chunk-V5M7SA3C.js.map +0 -1
- package/dist/newtype-yKTvFdg_.d.cts +0 -6
- package/dist/newtype-yKTvFdg_.d.ts +0 -6
- package/dist/oauth-session-DgItaMKN.d.cts +0 -56
- package/dist/oauth-session-DnKDI5ou.d.ts +0 -56
- package/dist/useCoinListOffers-C5lBlzcC.d.ts +0 -27
- package/dist/useCoinListOffers-CguwXaCX.d.cts +0 -27
- package/dist/useCoinListRequirements-BECx1cIw.d.ts +0 -31
- package/dist/useCoinListRequirements-CX2gV9gJ.d.cts +0 -31
- package/dist/useCompleteCoinListOAuth-BRhAqD4_.d.cts +0 -55
- package/dist/useCompleteCoinListOAuth-DEZpHjd6.d.ts +0 -55
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { N as Newtype, A as AssetDto, b as OfferId, d as OfferOptionId, k as Asset, l as AssetId } from './requirement-XWT0T_zO.js';
|
|
2
|
+
|
|
3
|
+
type AuthorizationCode = Newtype<string, 'AuthorizationCode'>;
|
|
4
|
+
declare const AuthorizationCode: (value: string) => AuthorizationCode;
|
|
5
|
+
type CodeVerifier = Newtype<string, 'CodeVerifier'>;
|
|
6
|
+
declare const CodeVerifier: (value: string) => CodeVerifier;
|
|
7
|
+
type CodeChallenge = Newtype<string, 'CodeChallenge'>;
|
|
8
|
+
declare const CodeChallenge: (value: string) => CodeChallenge;
|
|
9
|
+
type RedirectUri = Newtype<string, 'RedirectUri'>;
|
|
10
|
+
declare const RedirectUri: (value: string) => RedirectUri;
|
|
11
|
+
type ClientId = Newtype<string, 'ClientId'>;
|
|
12
|
+
declare const ClientId: (value: string) => ClientId;
|
|
13
|
+
type ClientSecret = Newtype<string, 'ClientSecret'>;
|
|
14
|
+
declare const ClientSecret: (value: string) => ClientSecret;
|
|
15
|
+
|
|
16
|
+
type QueryParamValue = string | number | boolean | null | undefined;
|
|
17
|
+
|
|
18
|
+
type Cursor = Newtype<string, 'Cursor'>;
|
|
19
|
+
declare const Cursor: (value: string) => Cursor;
|
|
20
|
+
interface PaginatedResponseDto<T> {
|
|
21
|
+
data: T[];
|
|
22
|
+
starting_after?: string;
|
|
23
|
+
starting_before?: string;
|
|
24
|
+
}
|
|
25
|
+
declare function fetchAllPages<A, P extends PaginationParams = PaginationParams>(fetchPage: (params: P) => Promise<PaginatedResponse<A>>, baseParams?: Omit<P, keyof PaginationParams>): Promise<A[]>;
|
|
26
|
+
interface PaginatedResponse<T> {
|
|
27
|
+
data: T[];
|
|
28
|
+
startingAfter: Cursor | null;
|
|
29
|
+
startingBefore: Cursor | null;
|
|
30
|
+
}
|
|
31
|
+
declare const PaginatedResponse: {
|
|
32
|
+
fromDto: <A, B>(dto: PaginatedResponseDto<A>, itemMapper: (item: A) => B) => PaginatedResponse<B>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Cursor-based pagination input used when requesting paginated API resources.
|
|
36
|
+
* Set `after` or `before` to navigate relative to a known cursor, and `limit`
|
|
37
|
+
* to control the maximum number of returned items.
|
|
38
|
+
*/
|
|
39
|
+
interface PaginationParams {
|
|
40
|
+
before?: Cursor;
|
|
41
|
+
after?: Cursor;
|
|
42
|
+
limit?: number;
|
|
43
|
+
}
|
|
44
|
+
declare const PaginationParams: {
|
|
45
|
+
toQueryParams: (params: PaginationParams) => Record<string, QueryParamValue>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
interface Config {
|
|
49
|
+
/** OAuth2 public identifier. */
|
|
50
|
+
readonly clientId: ClientId;
|
|
51
|
+
/**
|
|
52
|
+
* OAuth2 redirect URI. Recommended to point to a frontend page where
|
|
53
|
+
* {@link CoinListClient#completeOauth} can be called to complete the PKCE
|
|
54
|
+
* flow on the client side.
|
|
55
|
+
*/
|
|
56
|
+
readonly redirectUri: RedirectUri;
|
|
57
|
+
/**
|
|
58
|
+
* Recommended to leave undefined. Used to change the CoinList environment;
|
|
59
|
+
* default is production.
|
|
60
|
+
*/
|
|
61
|
+
readonly baseUrl?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* OAuth 2.0 token response (RFC 6749 §5.1).
|
|
66
|
+
* Maps to OpenAPI schema OauthToken.
|
|
67
|
+
*/
|
|
68
|
+
type OAuthSessionDto = {
|
|
69
|
+
access_token: string;
|
|
70
|
+
expires_in: number;
|
|
71
|
+
refresh_token?: string;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
type OAuthAccessToken = {
|
|
75
|
+
value: string;
|
|
76
|
+
expiresAt: Date;
|
|
77
|
+
};
|
|
78
|
+
type OAuthRefreshToken = Newtype<string, 'OAuthRefreshToken'>;
|
|
79
|
+
declare const OAuthRefreshToken: (value: string) => OAuthRefreshToken;
|
|
80
|
+
type OAuthSession = {
|
|
81
|
+
accessToken: OAuthAccessToken;
|
|
82
|
+
refreshToken?: OAuthRefreshToken;
|
|
83
|
+
};
|
|
84
|
+
declare const OAuthSession: {
|
|
85
|
+
fromDto: (dto: OAuthSessionDto) => OAuthSession;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
type ParticipationStatusDto = 'prepared' | 'pending' | 'submitted' | 'completed' | 'failed' | 'remit_submitted' | 'remitted' | 'remit_failed';
|
|
89
|
+
type ParticipationDto = {
|
|
90
|
+
object: 'participation';
|
|
91
|
+
id: string;
|
|
92
|
+
offer_id: string;
|
|
93
|
+
offer_option_id: string;
|
|
94
|
+
status: ParticipationStatusDto;
|
|
95
|
+
amount: string;
|
|
96
|
+
amount_string: string;
|
|
97
|
+
asset: AssetDto;
|
|
98
|
+
chain: string;
|
|
99
|
+
inserted_at: string | null | undefined;
|
|
100
|
+
updated_at: string | null | undefined;
|
|
101
|
+
wallet_address: string | null | undefined;
|
|
102
|
+
};
|
|
103
|
+
type CreateParticipationDto = {
|
|
104
|
+
offer_id: string;
|
|
105
|
+
offer_option_id: string;
|
|
106
|
+
chain: string;
|
|
107
|
+
wallet_address: string;
|
|
108
|
+
amount: string;
|
|
109
|
+
asset_id: string;
|
|
110
|
+
approval_transaction_hash: string | null | undefined;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** Unique identifier for a participation. */
|
|
114
|
+
type ParticipationId = Newtype<string, 'ParticipationId'>;
|
|
115
|
+
/** Casts a string into a typed {@link ParticipationId}. */
|
|
116
|
+
declare const ParticipationId: (value: string) => ParticipationId;
|
|
117
|
+
/** Blockchain identifier for where a participation is funded. */
|
|
118
|
+
type Blockchain = Newtype<string, 'Blockchain'>;
|
|
119
|
+
/** Casts a string into a typed {@link Blockchain}. */
|
|
120
|
+
declare const Blockchain: (value: string) => Blockchain;
|
|
121
|
+
/** Wallet address used for a participation. */
|
|
122
|
+
type WalletAddress = Newtype<string, 'WalletAddress'>;
|
|
123
|
+
/** Casts a string into a typed {@link WalletAddress}. */
|
|
124
|
+
declare const WalletAddress: (value: string) => WalletAddress;
|
|
125
|
+
/** Possible participation lifecycle states returned by the API. */
|
|
126
|
+
type ParticipationStatus = ParticipationStatusDto;
|
|
127
|
+
/** Pagination params for listing participations, with an optional offer filter. */
|
|
128
|
+
interface ParticipationsPaginationParams extends PaginationParams {
|
|
129
|
+
offerId?: OfferId;
|
|
130
|
+
}
|
|
131
|
+
declare const ParticipationsPaginationParams: {
|
|
132
|
+
toQueryParams: (params: ParticipationsPaginationParams) => Record<string, QueryParamValue>;
|
|
133
|
+
};
|
|
134
|
+
/** Domain model for a participation returned by CoinList APIs. */
|
|
135
|
+
type Participation = {
|
|
136
|
+
/** Unique participation id. */
|
|
137
|
+
id: ParticipationId;
|
|
138
|
+
/** Parent offer id. */
|
|
139
|
+
offerId: OfferId;
|
|
140
|
+
/** Selected offer option id. */
|
|
141
|
+
offerOptionId: OfferOptionId;
|
|
142
|
+
/** Current processing status. */
|
|
143
|
+
status: ParticipationStatus;
|
|
144
|
+
/** Raw participation amount from API. */
|
|
145
|
+
amount: string;
|
|
146
|
+
/** Human-readable formatted amount from API. */
|
|
147
|
+
displayAmount: string;
|
|
148
|
+
/** Asset metadata for the participation amount. */
|
|
149
|
+
asset: Asset;
|
|
150
|
+
/** Funding chain identifier. */
|
|
151
|
+
chain: Blockchain;
|
|
152
|
+
/** Creation timestamp, if returned by API. */
|
|
153
|
+
insertedAt: Date | null;
|
|
154
|
+
/** Last update timestamp, if returned by API. */
|
|
155
|
+
updatedAt: Date | null;
|
|
156
|
+
/** Wallet used for participation, blank values normalized to null. */
|
|
157
|
+
walletAddress: WalletAddress | null;
|
|
158
|
+
};
|
|
159
|
+
declare const Participation: {
|
|
160
|
+
/** Maps API DTO shape into the SDK participation domain model. */
|
|
161
|
+
fromDto: (dto: ParticipationDto) => Participation;
|
|
162
|
+
};
|
|
163
|
+
/** Parameters required to create a new participation. */
|
|
164
|
+
type CreateParticipationParams = {
|
|
165
|
+
/** Offer to participate in. */
|
|
166
|
+
offerId: OfferId;
|
|
167
|
+
/** Offer option selected for participation. */
|
|
168
|
+
offerOptionId: OfferOptionId;
|
|
169
|
+
/** Blockchain for funding. */
|
|
170
|
+
chain: Blockchain;
|
|
171
|
+
/** Wallet address that funds the participation. */
|
|
172
|
+
walletAddress: WalletAddress;
|
|
173
|
+
/** Raw amount to participate with. */
|
|
174
|
+
amount: string;
|
|
175
|
+
/** Funding asset id. */
|
|
176
|
+
assetId: AssetId;
|
|
177
|
+
/** Optional approval transaction hash, if applicable. */
|
|
178
|
+
approvalTransactionHash?: string | null;
|
|
179
|
+
};
|
|
180
|
+
declare const CreateParticipationParams: {
|
|
181
|
+
/** Maps participation creation params into API DTO payload. */
|
|
182
|
+
toDto: (params: CreateParticipationParams) => CreateParticipationDto;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export { AuthorizationCode as A, Blockchain as B, ClientId as C, type OAuthAccessToken as O, PaginatedResponse as P, RedirectUri as R, WalletAddress as W, ClientSecret as a, CodeChallenge as b, CodeVerifier as c, CreateParticipationParams as d, Cursor as e, OAuthRefreshToken as f, OAuthSession as g, type PaginatedResponseDto as h, PaginationParams as i, Participation as j, ParticipationId as k, type ParticipationStatus as l, ParticipationsPaginationParams as m, fetchAllPages as n, type Config as o };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
declare const __brand: unique symbol;
|
|
2
|
+
type Newtype<Base, Branding> = Base & {
|
|
3
|
+
readonly [__brand]: Branding;
|
|
4
|
+
};
|
|
2
5
|
|
|
3
6
|
type OfferDto = {
|
|
4
7
|
id: string;
|
|
@@ -199,4 +202,4 @@ declare const RequirementStatusInfo: {
|
|
|
199
202
|
fromStatusesDto: (dto: RequirementStatusesDto) => RequirementStatusInfo[];
|
|
200
203
|
};
|
|
201
204
|
|
|
202
|
-
export { type AssetDto as A, FaqItem as F, Link as L, Milestone as M, Offer as O, Requirement as R, TermItem as T, OfferDetail as a, OfferId as b, OfferOption as c, OfferOptionId as d, OfferOptionSlug as e, OfferSlug as f, RequirementId as g, RequirementStatusInfo as h, type RequirementStatusValue as i, type RequirementType as j, Asset as k, AssetId as l };
|
|
205
|
+
export { type AssetDto as A, FaqItem as F, Link as L, Milestone as M, type Newtype as N, Offer as O, Requirement as R, TermItem as T, OfferDetail as a, OfferId as b, OfferOption as c, OfferOptionId as d, OfferOptionSlug as e, OfferSlug as f, RequirementId as g, RequirementStatusInfo as h, type RequirementStatusValue as i, type RequirementType as j, Asset as k, AssetId as l };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
declare const __brand: unique symbol;
|
|
2
|
+
type Newtype<Base, Branding> = Base & {
|
|
3
|
+
readonly [__brand]: Branding;
|
|
4
|
+
};
|
|
2
5
|
|
|
3
6
|
type OfferDto = {
|
|
4
7
|
id: string;
|
|
@@ -199,4 +202,4 @@ declare const RequirementStatusInfo: {
|
|
|
199
202
|
fromStatusesDto: (dto: RequirementStatusesDto) => RequirementStatusInfo[];
|
|
200
203
|
};
|
|
201
204
|
|
|
202
|
-
export { type AssetDto as A, FaqItem as F, Link as L, Milestone as M, Offer as O, Requirement as R, TermItem as T, OfferDetail as a, OfferId as b, OfferOption as c, OfferOptionId as d, OfferOptionSlug as e, OfferSlug as f, RequirementId as g, RequirementStatusInfo as h, type RequirementStatusValue as i, type RequirementType as j, Asset as k, AssetId as l };
|
|
205
|
+
export { type AssetDto as A, FaqItem as F, Link as L, Milestone as M, type Newtype as N, Offer as O, Requirement as R, TermItem as T, OfferDetail as a, OfferId as b, OfferOption as c, OfferOptionId as d, OfferOptionSlug as e, OfferSlug as f, RequirementId as g, RequirementStatusInfo as h, type RequirementStatusValue as i, type RequirementType as j, Asset as k, AssetId as l };
|