@echoxyz/sonar-core 0.12.0 → 0.14.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/CHANGELOG.md +28 -0
- package/README.md +10 -3
- package/dist/index.cjs +19 -3
- package/dist/index.d.cts +66 -10
- package/dist/index.d.ts +66 -10
- package/dist/index.js +19 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @echoxyz/sonar-core
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add wrapper function and hook for ReadCommitmentData endpoint
|
|
8
|
+
|
|
9
|
+
## 0.13.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- c551d7c: Add BasicPermitV3 type with OpensAt and ClosesAt fields for time-gated commitment windows:
|
|
14
|
+
- Add `BasicPermitV3` type with new `OpensAt` and `ClosesAt` fields
|
|
15
|
+
- Add `BASIC_V3` to `PurchasePermitType` enum
|
|
16
|
+
- Update `PurchasePermit` conditional type to handle V3
|
|
17
|
+
- Update `GeneratePurchasePermitResponse` to include `BasicPermitV3`
|
|
18
|
+
- Mark `BasicPermitV2` as deprecated
|
|
19
|
+
|
|
20
|
+
- b2cd697: Rename Allocation API to Limits API to match backend changes:
|
|
21
|
+
- `fetchAllocation` → `fetchLimits`
|
|
22
|
+
- `AllocationResponse` → `LimitsResponse`
|
|
23
|
+
- Response fields renamed: `HasReservedAllocation` → `HasCustomCommitmentAmountLimit`, `ReservedAmountUSD` removed, `MaxAmountUSD` → `MaxCommitmentAmount`, added `MinCommitmentAmount`
|
|
24
|
+
- `PrePurchaseFailureReason.NO_RESERVED_ALLOCATION` → `PrePurchaseFailureReason.NO_CUSTOM_COMMITMENT_AMOUNT_LIMIT`
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- e276112: Add `pnpm fmt` script for running prettier and format check to CI
|
|
29
|
+
- 171a0db: Added support for ReadEntityInvestmentHistory API
|
|
30
|
+
|
|
3
31
|
## 0.12.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -72,6 +72,13 @@ export async function completeOAuthFromCallback() {
|
|
|
72
72
|
export async function exampleCalls() {
|
|
73
73
|
const { walletAddress } = useWallet(); // User's connected wallet.
|
|
74
74
|
|
|
75
|
+
// Get the authenticated user's profile information
|
|
76
|
+
const profile = await client.myProfile();
|
|
77
|
+
console.log(profile.EntityID); // Entity ID for the authenticated user
|
|
78
|
+
if (profile.EmailAddress) {
|
|
79
|
+
console.log(profile.EmailAddress); // Email address (only present if authorized with contact:email scope)
|
|
80
|
+
}
|
|
81
|
+
|
|
75
82
|
// Read the entity for linked to the wallet for the configured sale.
|
|
76
83
|
// If the authenticated user has not yet linked the wallet on Sonar, this will return a 404.
|
|
77
84
|
const { Entity } = await client.readEntity({ saleUUID, walletAddress });
|
|
@@ -96,9 +103,9 @@ export async function exampleCalls() {
|
|
|
96
103
|
console.log(permit.Signature, permit.Permit);
|
|
97
104
|
}
|
|
98
105
|
|
|
99
|
-
// Fetch
|
|
100
|
-
const
|
|
101
|
-
console.log(
|
|
106
|
+
// Fetch limits
|
|
107
|
+
const limits = await client.fetchLimits({ saleUUID, walletAddress });
|
|
108
|
+
console.log(limits);
|
|
102
109
|
}
|
|
103
110
|
```
|
|
104
111
|
|
package/dist/index.cjs
CHANGED
|
@@ -279,6 +279,12 @@ var SonarClient = class {
|
|
|
279
279
|
refresh_token: args.refreshToken
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
|
+
async myProfile() {
|
|
283
|
+
return this.postJSON("/externalapi.MyProfile", {});
|
|
284
|
+
}
|
|
285
|
+
async readEntityInvestmentHistory() {
|
|
286
|
+
return this.postJSON("/externalapi.ReadEntityInvestmentHistory", {});
|
|
287
|
+
}
|
|
282
288
|
async prePurchaseCheck(args) {
|
|
283
289
|
return this.postJSON("/externalapi.PrePurchaseCheck", {
|
|
284
290
|
SaleUUID: args.saleUUID,
|
|
@@ -293,8 +299,8 @@ var SonarClient = class {
|
|
|
293
299
|
PurchasingWalletAddress: args.walletAddress
|
|
294
300
|
});
|
|
295
301
|
}
|
|
296
|
-
async
|
|
297
|
-
return this.postJSON("/externalapi.
|
|
302
|
+
async fetchLimits(args) {
|
|
303
|
+
return this.postJSON("/externalapi.Limits", {
|
|
298
304
|
SaleUUID: args.saleUUID,
|
|
299
305
|
WalletAddress: args.walletAddress
|
|
300
306
|
});
|
|
@@ -310,6 +316,16 @@ var SonarClient = class {
|
|
|
310
316
|
SaleUUID: args.saleUUID
|
|
311
317
|
});
|
|
312
318
|
}
|
|
319
|
+
// Public API
|
|
320
|
+
async readCommitmentData(args) {
|
|
321
|
+
return this.postJSON(
|
|
322
|
+
"/sales.ReadCommitmentData",
|
|
323
|
+
{
|
|
324
|
+
SaleUUID: args.saleUUID
|
|
325
|
+
},
|
|
326
|
+
{ includeAuth: false }
|
|
327
|
+
);
|
|
328
|
+
}
|
|
313
329
|
};
|
|
314
330
|
var APIError = class extends Error {
|
|
315
331
|
status;
|
|
@@ -400,6 +416,7 @@ var SaleEligibility = /* @__PURE__ */ ((SaleEligibility2) => {
|
|
|
400
416
|
var PurchasePermitType = /* @__PURE__ */ ((PurchasePermitType2) => {
|
|
401
417
|
PurchasePermitType2["BASIC"] = "basic";
|
|
402
418
|
PurchasePermitType2["BASIC_V2"] = "basic-v2";
|
|
419
|
+
PurchasePermitType2["BASIC_V3"] = "basic-v3";
|
|
403
420
|
PurchasePermitType2["ALLOCATION"] = "allocation";
|
|
404
421
|
return PurchasePermitType2;
|
|
405
422
|
})(PurchasePermitType || {});
|
|
@@ -408,7 +425,6 @@ var PrePurchaseFailureReason = /* @__PURE__ */ ((PrePurchaseFailureReason2) => {
|
|
|
408
425
|
PrePurchaseFailureReason2["WALLET_RISK"] = "wallet-risk";
|
|
409
426
|
PrePurchaseFailureReason2["MAX_WALLETS_USED"] = "max-wallets-used";
|
|
410
427
|
PrePurchaseFailureReason2["REQUIRES_LIVENESS"] = "requires-liveness";
|
|
411
|
-
PrePurchaseFailureReason2["NO_RESERVED_ALLOCATION"] = "no-reserved-allocation";
|
|
412
428
|
PrePurchaseFailureReason2["SALE_NOT_ACTIVE"] = "sale-not-active";
|
|
413
429
|
PrePurchaseFailureReason2["WALLET_NOT_LINKED"] = "wallet-not-linked";
|
|
414
430
|
return PrePurchaseFailureReason2;
|
package/dist/index.d.cts
CHANGED
|
@@ -72,18 +72,31 @@ type BasicPermitV2 = {
|
|
|
72
72
|
MaxPrice: number;
|
|
73
73
|
Payload: Hex;
|
|
74
74
|
};
|
|
75
|
+
type BasicPermitV3 = {
|
|
76
|
+
SaleSpecificEntityID: Hex;
|
|
77
|
+
SaleUUID: Hex;
|
|
78
|
+
Wallet: Hex;
|
|
79
|
+
ExpiresAt: number;
|
|
80
|
+
MinAmount: string;
|
|
81
|
+
MaxAmount: string;
|
|
82
|
+
MinPrice: number;
|
|
83
|
+
MaxPrice: number;
|
|
84
|
+
OpensAt: number;
|
|
85
|
+
ClosesAt: number;
|
|
86
|
+
Payload: Hex;
|
|
87
|
+
};
|
|
75
88
|
declare enum PurchasePermitType {
|
|
76
89
|
BASIC = "basic",
|
|
77
90
|
BASIC_V2 = "basic-v2",
|
|
91
|
+
BASIC_V3 = "basic-v3",
|
|
78
92
|
ALLOCATION = "allocation"
|
|
79
93
|
}
|
|
80
|
-
type PurchasePermit<T extends PurchasePermitType> = T extends PurchasePermitType.BASIC ? BasicPermit : T extends PurchasePermitType.BASIC_V2 ? BasicPermitV2 : T extends PurchasePermitType.ALLOCATION ? AllocationPermit : never;
|
|
94
|
+
type PurchasePermit<T extends PurchasePermitType> = T extends PurchasePermitType.BASIC ? BasicPermit : T extends PurchasePermitType.BASIC_V2 ? BasicPermitV2 : T extends PurchasePermitType.BASIC_V3 ? BasicPermitV3 : T extends PurchasePermitType.ALLOCATION ? AllocationPermit : never;
|
|
81
95
|
declare enum PrePurchaseFailureReason {
|
|
82
96
|
UNKNOWN = "unknown",
|
|
83
97
|
WALLET_RISK = "wallet-risk",
|
|
84
98
|
MAX_WALLETS_USED = "max-wallets-used",
|
|
85
99
|
REQUIRES_LIVENESS = "requires-liveness",
|
|
86
|
-
NO_RESERVED_ALLOCATION = "no-reserved-allocation",
|
|
87
100
|
SALE_NOT_ACTIVE = "sale-not-active",
|
|
88
101
|
WALLET_NOT_LINKED = "wallet-not-linked"
|
|
89
102
|
}
|
|
@@ -101,6 +114,34 @@ type EntityDetails = {
|
|
|
101
114
|
SaleEligibility: SaleEligibility;
|
|
102
115
|
InvestingRegion: InvestingRegion;
|
|
103
116
|
};
|
|
117
|
+
type MyProfileResponse = {
|
|
118
|
+
EntityID: string;
|
|
119
|
+
EmailAddress?: string;
|
|
120
|
+
};
|
|
121
|
+
type EntityInvestment = {
|
|
122
|
+
CompanyName: string;
|
|
123
|
+
Round: string;
|
|
124
|
+
InvestedOn: string;
|
|
125
|
+
};
|
|
126
|
+
type EntityInvestmentHistoryResponse = {
|
|
127
|
+
Investments: EntityInvestment[];
|
|
128
|
+
};
|
|
129
|
+
type Commitment = {
|
|
130
|
+
CommitmentID: Hex;
|
|
131
|
+
SaleSpecificEntityID: Hex;
|
|
132
|
+
PriceNumerator: string;
|
|
133
|
+
PriceDenominator: string;
|
|
134
|
+
PriceMicroUSD?: string;
|
|
135
|
+
Amounts: WalletTokenAmount[];
|
|
136
|
+
CreatedAt: string;
|
|
137
|
+
ExtraRaw: Hex;
|
|
138
|
+
ExtraDataParsed: unknown;
|
|
139
|
+
};
|
|
140
|
+
type WalletTokenAmount = {
|
|
141
|
+
Wallet: Hex;
|
|
142
|
+
Token: Hex;
|
|
143
|
+
Amount: string;
|
|
144
|
+
};
|
|
104
145
|
|
|
105
146
|
type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
106
147
|
type PrePurchaseCheckResponse = {
|
|
@@ -109,13 +150,13 @@ type PrePurchaseCheckResponse = {
|
|
|
109
150
|
LivenessCheckURL: string;
|
|
110
151
|
};
|
|
111
152
|
type GeneratePurchasePermitResponse = {
|
|
112
|
-
PermitJSON: BasicPermit | BasicPermitV2 | AllocationPermit;
|
|
153
|
+
PermitJSON: BasicPermit | BasicPermitV2 | BasicPermitV3 | AllocationPermit;
|
|
113
154
|
Signature: Hex;
|
|
114
155
|
};
|
|
115
|
-
type
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
156
|
+
type LimitsResponse = {
|
|
157
|
+
HasCustomCommitmentAmountLimit: boolean;
|
|
158
|
+
MinCommitmentAmount: string;
|
|
159
|
+
MaxCommitmentAmount: string;
|
|
119
160
|
};
|
|
120
161
|
type ReadEntityResponse = {
|
|
121
162
|
Entity: EntityDetails;
|
|
@@ -123,6 +164,16 @@ type ReadEntityResponse = {
|
|
|
123
164
|
type ListAvailableEntitiesResponse = {
|
|
124
165
|
Entities: EntityDetails[];
|
|
125
166
|
};
|
|
167
|
+
type ReadCommitmentDataResponse = {
|
|
168
|
+
TotalCommitmentAmount: string;
|
|
169
|
+
ClearingPriceNumerator?: string;
|
|
170
|
+
ClearingPriceDenominator?: string;
|
|
171
|
+
ClearingPriceMicroUSD?: string;
|
|
172
|
+
PaymentTokenDecimals: number;
|
|
173
|
+
OfferedTokenDecimals?: number;
|
|
174
|
+
UniqueCommitmentCount: number;
|
|
175
|
+
Commitments: Commitment[];
|
|
176
|
+
};
|
|
126
177
|
type TokenResponse = {
|
|
127
178
|
access_token: string;
|
|
128
179
|
refresh_token: string;
|
|
@@ -157,6 +208,8 @@ declare class SonarClient {
|
|
|
157
208
|
refreshToken(args: {
|
|
158
209
|
refreshToken: string;
|
|
159
210
|
}): Promise<TokenResponse>;
|
|
211
|
+
myProfile(): Promise<MyProfileResponse>;
|
|
212
|
+
readEntityInvestmentHistory(): Promise<EntityInvestmentHistoryResponse>;
|
|
160
213
|
prePurchaseCheck(args: {
|
|
161
214
|
saleUUID: string;
|
|
162
215
|
entityID: EntityID;
|
|
@@ -167,10 +220,10 @@ declare class SonarClient {
|
|
|
167
220
|
entityID: EntityID;
|
|
168
221
|
walletAddress: string;
|
|
169
222
|
}): Promise<GeneratePurchasePermitResponse>;
|
|
170
|
-
|
|
223
|
+
fetchLimits(args: {
|
|
171
224
|
saleUUID: string;
|
|
172
225
|
walletAddress: string;
|
|
173
|
-
}): Promise<
|
|
226
|
+
}): Promise<LimitsResponse>;
|
|
174
227
|
readEntity(args: {
|
|
175
228
|
saleUUID: string;
|
|
176
229
|
walletAddress: string;
|
|
@@ -178,6 +231,9 @@ declare class SonarClient {
|
|
|
178
231
|
listAvailableEntities(args: {
|
|
179
232
|
saleUUID: string;
|
|
180
233
|
}): Promise<ListAvailableEntitiesResponse>;
|
|
234
|
+
readCommitmentData(args: {
|
|
235
|
+
saleUUID: string;
|
|
236
|
+
}): Promise<ReadCommitmentDataResponse>;
|
|
181
237
|
}
|
|
182
238
|
declare class APIError extends Error {
|
|
183
239
|
readonly status: number;
|
|
@@ -212,4 +268,4 @@ type CreateClientOptions = {
|
|
|
212
268
|
};
|
|
213
269
|
declare function createClient(options?: CreateClientOptions): SonarClient;
|
|
214
270
|
|
|
215
|
-
export { APIError, type AllocationPermit, type
|
|
271
|
+
export { APIError, type AllocationPermit, type BasicPermit, type BasicPermitV2, type BasicPermitV3, type BuildAuthorizationUrlArgs, type ClientOptions, type Commitment, type CreateClientOptions, type EntityDetails, type EntityID, type EntityInvestment, type EntityInvestmentHistoryResponse, EntitySetupState, EntityType, type FetchLike, type GeneratePurchasePermitResponse, type Hex, InvestingRegion, type LimitsResponse, type ListAvailableEntitiesResponse, type MyProfileResponse, type PrePurchaseCheckResponse, PrePurchaseFailureReason, type PurchasePermit, PurchasePermitType, type ReadCommitmentDataResponse, type ReadEntityResponse, SaleEligibility, SonarClient, type StorageLike, type TokenResponse, type WalletTokenAmount, buildAuthorizationUrl, createClient, createMemoryStorage, createWebStorage, generatePKCEParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -72,18 +72,31 @@ type BasicPermitV2 = {
|
|
|
72
72
|
MaxPrice: number;
|
|
73
73
|
Payload: Hex;
|
|
74
74
|
};
|
|
75
|
+
type BasicPermitV3 = {
|
|
76
|
+
SaleSpecificEntityID: Hex;
|
|
77
|
+
SaleUUID: Hex;
|
|
78
|
+
Wallet: Hex;
|
|
79
|
+
ExpiresAt: number;
|
|
80
|
+
MinAmount: string;
|
|
81
|
+
MaxAmount: string;
|
|
82
|
+
MinPrice: number;
|
|
83
|
+
MaxPrice: number;
|
|
84
|
+
OpensAt: number;
|
|
85
|
+
ClosesAt: number;
|
|
86
|
+
Payload: Hex;
|
|
87
|
+
};
|
|
75
88
|
declare enum PurchasePermitType {
|
|
76
89
|
BASIC = "basic",
|
|
77
90
|
BASIC_V2 = "basic-v2",
|
|
91
|
+
BASIC_V3 = "basic-v3",
|
|
78
92
|
ALLOCATION = "allocation"
|
|
79
93
|
}
|
|
80
|
-
type PurchasePermit<T extends PurchasePermitType> = T extends PurchasePermitType.BASIC ? BasicPermit : T extends PurchasePermitType.BASIC_V2 ? BasicPermitV2 : T extends PurchasePermitType.ALLOCATION ? AllocationPermit : never;
|
|
94
|
+
type PurchasePermit<T extends PurchasePermitType> = T extends PurchasePermitType.BASIC ? BasicPermit : T extends PurchasePermitType.BASIC_V2 ? BasicPermitV2 : T extends PurchasePermitType.BASIC_V3 ? BasicPermitV3 : T extends PurchasePermitType.ALLOCATION ? AllocationPermit : never;
|
|
81
95
|
declare enum PrePurchaseFailureReason {
|
|
82
96
|
UNKNOWN = "unknown",
|
|
83
97
|
WALLET_RISK = "wallet-risk",
|
|
84
98
|
MAX_WALLETS_USED = "max-wallets-used",
|
|
85
99
|
REQUIRES_LIVENESS = "requires-liveness",
|
|
86
|
-
NO_RESERVED_ALLOCATION = "no-reserved-allocation",
|
|
87
100
|
SALE_NOT_ACTIVE = "sale-not-active",
|
|
88
101
|
WALLET_NOT_LINKED = "wallet-not-linked"
|
|
89
102
|
}
|
|
@@ -101,6 +114,34 @@ type EntityDetails = {
|
|
|
101
114
|
SaleEligibility: SaleEligibility;
|
|
102
115
|
InvestingRegion: InvestingRegion;
|
|
103
116
|
};
|
|
117
|
+
type MyProfileResponse = {
|
|
118
|
+
EntityID: string;
|
|
119
|
+
EmailAddress?: string;
|
|
120
|
+
};
|
|
121
|
+
type EntityInvestment = {
|
|
122
|
+
CompanyName: string;
|
|
123
|
+
Round: string;
|
|
124
|
+
InvestedOn: string;
|
|
125
|
+
};
|
|
126
|
+
type EntityInvestmentHistoryResponse = {
|
|
127
|
+
Investments: EntityInvestment[];
|
|
128
|
+
};
|
|
129
|
+
type Commitment = {
|
|
130
|
+
CommitmentID: Hex;
|
|
131
|
+
SaleSpecificEntityID: Hex;
|
|
132
|
+
PriceNumerator: string;
|
|
133
|
+
PriceDenominator: string;
|
|
134
|
+
PriceMicroUSD?: string;
|
|
135
|
+
Amounts: WalletTokenAmount[];
|
|
136
|
+
CreatedAt: string;
|
|
137
|
+
ExtraRaw: Hex;
|
|
138
|
+
ExtraDataParsed: unknown;
|
|
139
|
+
};
|
|
140
|
+
type WalletTokenAmount = {
|
|
141
|
+
Wallet: Hex;
|
|
142
|
+
Token: Hex;
|
|
143
|
+
Amount: string;
|
|
144
|
+
};
|
|
104
145
|
|
|
105
146
|
type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
106
147
|
type PrePurchaseCheckResponse = {
|
|
@@ -109,13 +150,13 @@ type PrePurchaseCheckResponse = {
|
|
|
109
150
|
LivenessCheckURL: string;
|
|
110
151
|
};
|
|
111
152
|
type GeneratePurchasePermitResponse = {
|
|
112
|
-
PermitJSON: BasicPermit | BasicPermitV2 | AllocationPermit;
|
|
153
|
+
PermitJSON: BasicPermit | BasicPermitV2 | BasicPermitV3 | AllocationPermit;
|
|
113
154
|
Signature: Hex;
|
|
114
155
|
};
|
|
115
|
-
type
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
156
|
+
type LimitsResponse = {
|
|
157
|
+
HasCustomCommitmentAmountLimit: boolean;
|
|
158
|
+
MinCommitmentAmount: string;
|
|
159
|
+
MaxCommitmentAmount: string;
|
|
119
160
|
};
|
|
120
161
|
type ReadEntityResponse = {
|
|
121
162
|
Entity: EntityDetails;
|
|
@@ -123,6 +164,16 @@ type ReadEntityResponse = {
|
|
|
123
164
|
type ListAvailableEntitiesResponse = {
|
|
124
165
|
Entities: EntityDetails[];
|
|
125
166
|
};
|
|
167
|
+
type ReadCommitmentDataResponse = {
|
|
168
|
+
TotalCommitmentAmount: string;
|
|
169
|
+
ClearingPriceNumerator?: string;
|
|
170
|
+
ClearingPriceDenominator?: string;
|
|
171
|
+
ClearingPriceMicroUSD?: string;
|
|
172
|
+
PaymentTokenDecimals: number;
|
|
173
|
+
OfferedTokenDecimals?: number;
|
|
174
|
+
UniqueCommitmentCount: number;
|
|
175
|
+
Commitments: Commitment[];
|
|
176
|
+
};
|
|
126
177
|
type TokenResponse = {
|
|
127
178
|
access_token: string;
|
|
128
179
|
refresh_token: string;
|
|
@@ -157,6 +208,8 @@ declare class SonarClient {
|
|
|
157
208
|
refreshToken(args: {
|
|
158
209
|
refreshToken: string;
|
|
159
210
|
}): Promise<TokenResponse>;
|
|
211
|
+
myProfile(): Promise<MyProfileResponse>;
|
|
212
|
+
readEntityInvestmentHistory(): Promise<EntityInvestmentHistoryResponse>;
|
|
160
213
|
prePurchaseCheck(args: {
|
|
161
214
|
saleUUID: string;
|
|
162
215
|
entityID: EntityID;
|
|
@@ -167,10 +220,10 @@ declare class SonarClient {
|
|
|
167
220
|
entityID: EntityID;
|
|
168
221
|
walletAddress: string;
|
|
169
222
|
}): Promise<GeneratePurchasePermitResponse>;
|
|
170
|
-
|
|
223
|
+
fetchLimits(args: {
|
|
171
224
|
saleUUID: string;
|
|
172
225
|
walletAddress: string;
|
|
173
|
-
}): Promise<
|
|
226
|
+
}): Promise<LimitsResponse>;
|
|
174
227
|
readEntity(args: {
|
|
175
228
|
saleUUID: string;
|
|
176
229
|
walletAddress: string;
|
|
@@ -178,6 +231,9 @@ declare class SonarClient {
|
|
|
178
231
|
listAvailableEntities(args: {
|
|
179
232
|
saleUUID: string;
|
|
180
233
|
}): Promise<ListAvailableEntitiesResponse>;
|
|
234
|
+
readCommitmentData(args: {
|
|
235
|
+
saleUUID: string;
|
|
236
|
+
}): Promise<ReadCommitmentDataResponse>;
|
|
181
237
|
}
|
|
182
238
|
declare class APIError extends Error {
|
|
183
239
|
readonly status: number;
|
|
@@ -212,4 +268,4 @@ type CreateClientOptions = {
|
|
|
212
268
|
};
|
|
213
269
|
declare function createClient(options?: CreateClientOptions): SonarClient;
|
|
214
270
|
|
|
215
|
-
export { APIError, type AllocationPermit, type
|
|
271
|
+
export { APIError, type AllocationPermit, type BasicPermit, type BasicPermitV2, type BasicPermitV3, type BuildAuthorizationUrlArgs, type ClientOptions, type Commitment, type CreateClientOptions, type EntityDetails, type EntityID, type EntityInvestment, type EntityInvestmentHistoryResponse, EntitySetupState, EntityType, type FetchLike, type GeneratePurchasePermitResponse, type Hex, InvestingRegion, type LimitsResponse, type ListAvailableEntitiesResponse, type MyProfileResponse, type PrePurchaseCheckResponse, PrePurchaseFailureReason, type PurchasePermit, PurchasePermitType, type ReadCommitmentDataResponse, type ReadEntityResponse, SaleEligibility, SonarClient, type StorageLike, type TokenResponse, type WalletTokenAmount, buildAuthorizationUrl, createClient, createMemoryStorage, createWebStorage, generatePKCEParams };
|
package/dist/index.js
CHANGED
|
@@ -242,6 +242,12 @@ var SonarClient = class {
|
|
|
242
242
|
refresh_token: args.refreshToken
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
+
async myProfile() {
|
|
246
|
+
return this.postJSON("/externalapi.MyProfile", {});
|
|
247
|
+
}
|
|
248
|
+
async readEntityInvestmentHistory() {
|
|
249
|
+
return this.postJSON("/externalapi.ReadEntityInvestmentHistory", {});
|
|
250
|
+
}
|
|
245
251
|
async prePurchaseCheck(args) {
|
|
246
252
|
return this.postJSON("/externalapi.PrePurchaseCheck", {
|
|
247
253
|
SaleUUID: args.saleUUID,
|
|
@@ -256,8 +262,8 @@ var SonarClient = class {
|
|
|
256
262
|
PurchasingWalletAddress: args.walletAddress
|
|
257
263
|
});
|
|
258
264
|
}
|
|
259
|
-
async
|
|
260
|
-
return this.postJSON("/externalapi.
|
|
265
|
+
async fetchLimits(args) {
|
|
266
|
+
return this.postJSON("/externalapi.Limits", {
|
|
261
267
|
SaleUUID: args.saleUUID,
|
|
262
268
|
WalletAddress: args.walletAddress
|
|
263
269
|
});
|
|
@@ -273,6 +279,16 @@ var SonarClient = class {
|
|
|
273
279
|
SaleUUID: args.saleUUID
|
|
274
280
|
});
|
|
275
281
|
}
|
|
282
|
+
// Public API
|
|
283
|
+
async readCommitmentData(args) {
|
|
284
|
+
return this.postJSON(
|
|
285
|
+
"/sales.ReadCommitmentData",
|
|
286
|
+
{
|
|
287
|
+
SaleUUID: args.saleUUID
|
|
288
|
+
},
|
|
289
|
+
{ includeAuth: false }
|
|
290
|
+
);
|
|
291
|
+
}
|
|
276
292
|
};
|
|
277
293
|
var APIError = class extends Error {
|
|
278
294
|
status;
|
|
@@ -363,6 +379,7 @@ var SaleEligibility = /* @__PURE__ */ ((SaleEligibility2) => {
|
|
|
363
379
|
var PurchasePermitType = /* @__PURE__ */ ((PurchasePermitType2) => {
|
|
364
380
|
PurchasePermitType2["BASIC"] = "basic";
|
|
365
381
|
PurchasePermitType2["BASIC_V2"] = "basic-v2";
|
|
382
|
+
PurchasePermitType2["BASIC_V3"] = "basic-v3";
|
|
366
383
|
PurchasePermitType2["ALLOCATION"] = "allocation";
|
|
367
384
|
return PurchasePermitType2;
|
|
368
385
|
})(PurchasePermitType || {});
|
|
@@ -371,7 +388,6 @@ var PrePurchaseFailureReason = /* @__PURE__ */ ((PrePurchaseFailureReason2) => {
|
|
|
371
388
|
PrePurchaseFailureReason2["WALLET_RISK"] = "wallet-risk";
|
|
372
389
|
PrePurchaseFailureReason2["MAX_WALLETS_USED"] = "max-wallets-used";
|
|
373
390
|
PrePurchaseFailureReason2["REQUIRES_LIVENESS"] = "requires-liveness";
|
|
374
|
-
PrePurchaseFailureReason2["NO_RESERVED_ALLOCATION"] = "no-reserved-allocation";
|
|
375
391
|
PrePurchaseFailureReason2["SALE_NOT_ACTIVE"] = "sale-not-active";
|
|
376
392
|
PrePurchaseFailureReason2["WALLET_NOT_LINKED"] = "wallet-not-linked";
|
|
377
393
|
return PrePurchaseFailureReason2;
|