@echoxyz/sonar-core 0.2.0 → 0.3.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 +12 -0
- package/README.md +1 -3
- package/dist/index.cjs +11 -2
- package/dist/index.d.cts +14 -8
- package/dist/index.d.ts +14 -8
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @echoxyz/sonar-core
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c032c29: Strip EntityType param from API requests
|
|
8
|
+
|
|
9
|
+
## 0.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- affa026: Add missing values to PrePurchaseFailureReason enum
|
|
14
|
+
|
|
3
15
|
## 0.2.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ pnpm add @echoxyz/sonar-core
|
|
|
13
13
|
The default client targets Echo’s hosted API and reads the auth token from `localStorage` under the `sonar:auth-token` key.
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
-
import { createClient, buildAuthorizationUrl, generatePKCEParams
|
|
16
|
+
import { createClient, buildAuthorizationUrl, generatePKCEParams } from "@echoxyz/sonar-core";
|
|
17
17
|
|
|
18
18
|
// Configure once at app startup
|
|
19
19
|
const saleUUID = "<your-sale-uuid>";
|
|
@@ -79,7 +79,6 @@ export async function exampleCalls() {
|
|
|
79
79
|
const pre = await client.prePurchaseCheck({
|
|
80
80
|
saleUUID,
|
|
81
81
|
entityUUID: Entity.EntityUUID,
|
|
82
|
-
entityType: EntityType.USER, // or EntityType.ORGANIZATION
|
|
83
82
|
walletAddress: "0x1234...abcd" as `0x${string}`,
|
|
84
83
|
});
|
|
85
84
|
|
|
@@ -88,7 +87,6 @@ export async function exampleCalls() {
|
|
|
88
87
|
const permit = await client.generatePurchasePermit({
|
|
89
88
|
saleUUID,
|
|
90
89
|
entityUUID: Entity.EntityUUID,
|
|
91
|
-
entityType: EntityType.USER,
|
|
92
90
|
walletAddress: "0x1234...abcd" as `0x${string}`,
|
|
93
91
|
});
|
|
94
92
|
console.log(permit.Signature, permit.Permit);
|
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ __export(index_exports, {
|
|
|
22
22
|
APIError: () => APIError,
|
|
23
23
|
EntitySetupState: () => EntitySetupState,
|
|
24
24
|
EntityType: () => EntityType,
|
|
25
|
+
InvestingRegion: () => InvestingRegion,
|
|
25
26
|
PrePurchaseFailureReason: () => PrePurchaseFailureReason,
|
|
26
27
|
PurchasePermitType: () => PurchasePermitType,
|
|
27
28
|
SaleEligibility: () => SaleEligibility,
|
|
@@ -277,7 +278,6 @@ var SonarClient = class {
|
|
|
277
278
|
return this.postJSON("/externalapi.PrePurchaseCheck", {
|
|
278
279
|
SaleUUID: args.saleUUID,
|
|
279
280
|
EntityUUID: args.entityUUID,
|
|
280
|
-
EntityType: args.entityType,
|
|
281
281
|
PurchasingWalletAddress: args.walletAddress
|
|
282
282
|
});
|
|
283
283
|
}
|
|
@@ -285,7 +285,6 @@ var SonarClient = class {
|
|
|
285
285
|
return this.postJSON("/externalapi.GenerateSalePurchasePermit", {
|
|
286
286
|
SaleUUID: args.saleUUID,
|
|
287
287
|
EntityUUID: args.entityUUID,
|
|
288
|
-
EntityType: args.entityType,
|
|
289
288
|
PurchasingWalletAddress: args.walletAddress
|
|
290
289
|
});
|
|
291
290
|
}
|
|
@@ -376,6 +375,7 @@ var EntityType = /* @__PURE__ */ ((EntityType2) => {
|
|
|
376
375
|
var EntitySetupState = /* @__PURE__ */ ((EntitySetupState2) => {
|
|
377
376
|
EntitySetupState2["NOT_STARTED"] = "not-started";
|
|
378
377
|
EntitySetupState2["IN_PROGRESS"] = "in-progress";
|
|
378
|
+
EntitySetupState2["READY_FOR_REVIEW"] = "ready-for-review";
|
|
379
379
|
EntitySetupState2["IN_REVIEW"] = "in-review";
|
|
380
380
|
EntitySetupState2["FAILURE"] = "failure";
|
|
381
381
|
EntitySetupState2["FAILURE_FINAL"] = "failure-final";
|
|
@@ -399,8 +399,16 @@ var PrePurchaseFailureReason = /* @__PURE__ */ ((PrePurchaseFailureReason2) => {
|
|
|
399
399
|
PrePurchaseFailureReason2["MAX_WALLETS_USED"] = "max-wallets-used";
|
|
400
400
|
PrePurchaseFailureReason2["REQUIRES_LIVENESS"] = "requires-liveness";
|
|
401
401
|
PrePurchaseFailureReason2["NO_RESERVED_ALLOCATION"] = "no-reserved-allocation";
|
|
402
|
+
PrePurchaseFailureReason2["SALE_NOT_ACTIVE"] = "sale-not-active";
|
|
403
|
+
PrePurchaseFailureReason2["WALLET_NOT_LINKED"] = "wallet-not-linked";
|
|
402
404
|
return PrePurchaseFailureReason2;
|
|
403
405
|
})(PrePurchaseFailureReason || {});
|
|
406
|
+
var InvestingRegion = /* @__PURE__ */ ((InvestingRegion2) => {
|
|
407
|
+
InvestingRegion2["UNKNOWN"] = "unknown";
|
|
408
|
+
InvestingRegion2["OTHER"] = "other";
|
|
409
|
+
InvestingRegion2["US"] = "us";
|
|
410
|
+
return InvestingRegion2;
|
|
411
|
+
})(InvestingRegion || {});
|
|
404
412
|
|
|
405
413
|
// src/index.ts
|
|
406
414
|
var DEFAULT_API_URL = "https://api.echo.xyz";
|
|
@@ -424,6 +432,7 @@ function createClient(options) {
|
|
|
424
432
|
APIError,
|
|
425
433
|
EntitySetupState,
|
|
426
434
|
EntityType,
|
|
435
|
+
InvestingRegion,
|
|
427
436
|
PrePurchaseFailureReason,
|
|
428
437
|
PurchasePermitType,
|
|
429
438
|
SaleEligibility,
|
package/dist/index.d.cts
CHANGED
|
@@ -35,6 +35,7 @@ declare enum EntityType {
|
|
|
35
35
|
declare enum EntitySetupState {
|
|
36
36
|
NOT_STARTED = "not-started",
|
|
37
37
|
IN_PROGRESS = "in-progress",
|
|
38
|
+
READY_FOR_REVIEW = "ready-for-review",
|
|
38
39
|
IN_REVIEW = "in-review",
|
|
39
40
|
FAILURE = "failure",
|
|
40
41
|
FAILURE_FINAL = "failure-final",
|
|
@@ -67,15 +68,22 @@ declare enum PrePurchaseFailureReason {
|
|
|
67
68
|
WALLET_RISK = "wallet-risk",
|
|
68
69
|
MAX_WALLETS_USED = "max-wallets-used",
|
|
69
70
|
REQUIRES_LIVENESS = "requires-liveness",
|
|
70
|
-
NO_RESERVED_ALLOCATION = "no-reserved-allocation"
|
|
71
|
+
NO_RESERVED_ALLOCATION = "no-reserved-allocation",
|
|
72
|
+
SALE_NOT_ACTIVE = "sale-not-active",
|
|
73
|
+
WALLET_NOT_LINKED = "wallet-not-linked"
|
|
74
|
+
}
|
|
75
|
+
declare enum InvestingRegion {
|
|
76
|
+
UNKNOWN = "unknown",
|
|
77
|
+
OTHER = "other",
|
|
78
|
+
US = "us"
|
|
71
79
|
}
|
|
72
80
|
type EntityDetails = {
|
|
73
81
|
Label: string;
|
|
74
82
|
EntityUUID: string;
|
|
75
83
|
EntityType: EntityType;
|
|
76
|
-
EntitySetupState:
|
|
77
|
-
SaleEligibility:
|
|
78
|
-
InvestingRegion:
|
|
84
|
+
EntitySetupState: EntitySetupState;
|
|
85
|
+
SaleEligibility: SaleEligibility;
|
|
86
|
+
InvestingRegion: InvestingRegion;
|
|
79
87
|
ObfuscatedEntityID: `0x${string}`;
|
|
80
88
|
};
|
|
81
89
|
|
|
@@ -86,7 +94,7 @@ type PrePurchaseCheckResponse = {
|
|
|
86
94
|
LivenessCheckURL: string;
|
|
87
95
|
};
|
|
88
96
|
type GeneratePurchasePermitResponse = {
|
|
89
|
-
|
|
97
|
+
PermitJSON: BasicPermit | AllocationPermit;
|
|
90
98
|
Signature: string;
|
|
91
99
|
};
|
|
92
100
|
type AllocationResponse = {
|
|
@@ -127,13 +135,11 @@ declare class SonarClient {
|
|
|
127
135
|
prePurchaseCheck(args: {
|
|
128
136
|
saleUUID: string;
|
|
129
137
|
entityUUID: string;
|
|
130
|
-
entityType: EntityType;
|
|
131
138
|
walletAddress: string;
|
|
132
139
|
}): Promise<PrePurchaseCheckResponse>;
|
|
133
140
|
generatePurchasePermit(args: {
|
|
134
141
|
saleUUID: string;
|
|
135
142
|
entityUUID: string;
|
|
136
|
-
entityType: EntityType;
|
|
137
143
|
walletAddress: string;
|
|
138
144
|
}): Promise<GeneratePurchasePermitResponse>;
|
|
139
145
|
fetchAllocation(args: {
|
|
@@ -180,4 +186,4 @@ type CreateClientOptions = {
|
|
|
180
186
|
};
|
|
181
187
|
declare function createClient(options: CreateClientOptions): SonarClient;
|
|
182
188
|
|
|
183
|
-
export { APIError, type AllocationPermit, type AllocationResponse, type BasicPermit, type BuildAuthorizationUrlArgs, type ClientOptions, type CreateClientOptions, type EntityDetails, EntitySetupState, EntityType, type FetchLike, type GeneratePurchasePermitResponse, type Hex, type PrePurchaseCheckResponse, PrePurchaseFailureReason, type PurchasePermit, PurchasePermitType, type ReadEntityResponse, SaleEligibility, SonarClient, type StorageLike, buildAuthorizationUrl, createClient, createMemoryStorage, createWebStorage, generatePKCEParams };
|
|
189
|
+
export { APIError, type AllocationPermit, type AllocationResponse, type BasicPermit, type BuildAuthorizationUrlArgs, type ClientOptions, type CreateClientOptions, type EntityDetails, EntitySetupState, EntityType, type FetchLike, type GeneratePurchasePermitResponse, type Hex, InvestingRegion, type PrePurchaseCheckResponse, PrePurchaseFailureReason, type PurchasePermit, PurchasePermitType, type ReadEntityResponse, SaleEligibility, SonarClient, type StorageLike, buildAuthorizationUrl, createClient, createMemoryStorage, createWebStorage, generatePKCEParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ declare enum EntityType {
|
|
|
35
35
|
declare enum EntitySetupState {
|
|
36
36
|
NOT_STARTED = "not-started",
|
|
37
37
|
IN_PROGRESS = "in-progress",
|
|
38
|
+
READY_FOR_REVIEW = "ready-for-review",
|
|
38
39
|
IN_REVIEW = "in-review",
|
|
39
40
|
FAILURE = "failure",
|
|
40
41
|
FAILURE_FINAL = "failure-final",
|
|
@@ -67,15 +68,22 @@ declare enum PrePurchaseFailureReason {
|
|
|
67
68
|
WALLET_RISK = "wallet-risk",
|
|
68
69
|
MAX_WALLETS_USED = "max-wallets-used",
|
|
69
70
|
REQUIRES_LIVENESS = "requires-liveness",
|
|
70
|
-
NO_RESERVED_ALLOCATION = "no-reserved-allocation"
|
|
71
|
+
NO_RESERVED_ALLOCATION = "no-reserved-allocation",
|
|
72
|
+
SALE_NOT_ACTIVE = "sale-not-active",
|
|
73
|
+
WALLET_NOT_LINKED = "wallet-not-linked"
|
|
74
|
+
}
|
|
75
|
+
declare enum InvestingRegion {
|
|
76
|
+
UNKNOWN = "unknown",
|
|
77
|
+
OTHER = "other",
|
|
78
|
+
US = "us"
|
|
71
79
|
}
|
|
72
80
|
type EntityDetails = {
|
|
73
81
|
Label: string;
|
|
74
82
|
EntityUUID: string;
|
|
75
83
|
EntityType: EntityType;
|
|
76
|
-
EntitySetupState:
|
|
77
|
-
SaleEligibility:
|
|
78
|
-
InvestingRegion:
|
|
84
|
+
EntitySetupState: EntitySetupState;
|
|
85
|
+
SaleEligibility: SaleEligibility;
|
|
86
|
+
InvestingRegion: InvestingRegion;
|
|
79
87
|
ObfuscatedEntityID: `0x${string}`;
|
|
80
88
|
};
|
|
81
89
|
|
|
@@ -86,7 +94,7 @@ type PrePurchaseCheckResponse = {
|
|
|
86
94
|
LivenessCheckURL: string;
|
|
87
95
|
};
|
|
88
96
|
type GeneratePurchasePermitResponse = {
|
|
89
|
-
|
|
97
|
+
PermitJSON: BasicPermit | AllocationPermit;
|
|
90
98
|
Signature: string;
|
|
91
99
|
};
|
|
92
100
|
type AllocationResponse = {
|
|
@@ -127,13 +135,11 @@ declare class SonarClient {
|
|
|
127
135
|
prePurchaseCheck(args: {
|
|
128
136
|
saleUUID: string;
|
|
129
137
|
entityUUID: string;
|
|
130
|
-
entityType: EntityType;
|
|
131
138
|
walletAddress: string;
|
|
132
139
|
}): Promise<PrePurchaseCheckResponse>;
|
|
133
140
|
generatePurchasePermit(args: {
|
|
134
141
|
saleUUID: string;
|
|
135
142
|
entityUUID: string;
|
|
136
|
-
entityType: EntityType;
|
|
137
143
|
walletAddress: string;
|
|
138
144
|
}): Promise<GeneratePurchasePermitResponse>;
|
|
139
145
|
fetchAllocation(args: {
|
|
@@ -180,4 +186,4 @@ type CreateClientOptions = {
|
|
|
180
186
|
};
|
|
181
187
|
declare function createClient(options: CreateClientOptions): SonarClient;
|
|
182
188
|
|
|
183
|
-
export { APIError, type AllocationPermit, type AllocationResponse, type BasicPermit, type BuildAuthorizationUrlArgs, type ClientOptions, type CreateClientOptions, type EntityDetails, EntitySetupState, EntityType, type FetchLike, type GeneratePurchasePermitResponse, type Hex, type PrePurchaseCheckResponse, PrePurchaseFailureReason, type PurchasePermit, PurchasePermitType, type ReadEntityResponse, SaleEligibility, SonarClient, type StorageLike, buildAuthorizationUrl, createClient, createMemoryStorage, createWebStorage, generatePKCEParams };
|
|
189
|
+
export { APIError, type AllocationPermit, type AllocationResponse, type BasicPermit, type BuildAuthorizationUrlArgs, type ClientOptions, type CreateClientOptions, type EntityDetails, EntitySetupState, EntityType, type FetchLike, type GeneratePurchasePermitResponse, type Hex, InvestingRegion, type PrePurchaseCheckResponse, PrePurchaseFailureReason, type PurchasePermit, PurchasePermitType, type ReadEntityResponse, SaleEligibility, SonarClient, type StorageLike, buildAuthorizationUrl, createClient, createMemoryStorage, createWebStorage, generatePKCEParams };
|
package/dist/index.js
CHANGED
|
@@ -241,7 +241,6 @@ var SonarClient = class {
|
|
|
241
241
|
return this.postJSON("/externalapi.PrePurchaseCheck", {
|
|
242
242
|
SaleUUID: args.saleUUID,
|
|
243
243
|
EntityUUID: args.entityUUID,
|
|
244
|
-
EntityType: args.entityType,
|
|
245
244
|
PurchasingWalletAddress: args.walletAddress
|
|
246
245
|
});
|
|
247
246
|
}
|
|
@@ -249,7 +248,6 @@ var SonarClient = class {
|
|
|
249
248
|
return this.postJSON("/externalapi.GenerateSalePurchasePermit", {
|
|
250
249
|
SaleUUID: args.saleUUID,
|
|
251
250
|
EntityUUID: args.entityUUID,
|
|
252
|
-
EntityType: args.entityType,
|
|
253
251
|
PurchasingWalletAddress: args.walletAddress
|
|
254
252
|
});
|
|
255
253
|
}
|
|
@@ -340,6 +338,7 @@ var EntityType = /* @__PURE__ */ ((EntityType2) => {
|
|
|
340
338
|
var EntitySetupState = /* @__PURE__ */ ((EntitySetupState2) => {
|
|
341
339
|
EntitySetupState2["NOT_STARTED"] = "not-started";
|
|
342
340
|
EntitySetupState2["IN_PROGRESS"] = "in-progress";
|
|
341
|
+
EntitySetupState2["READY_FOR_REVIEW"] = "ready-for-review";
|
|
343
342
|
EntitySetupState2["IN_REVIEW"] = "in-review";
|
|
344
343
|
EntitySetupState2["FAILURE"] = "failure";
|
|
345
344
|
EntitySetupState2["FAILURE_FINAL"] = "failure-final";
|
|
@@ -363,8 +362,16 @@ var PrePurchaseFailureReason = /* @__PURE__ */ ((PrePurchaseFailureReason2) => {
|
|
|
363
362
|
PrePurchaseFailureReason2["MAX_WALLETS_USED"] = "max-wallets-used";
|
|
364
363
|
PrePurchaseFailureReason2["REQUIRES_LIVENESS"] = "requires-liveness";
|
|
365
364
|
PrePurchaseFailureReason2["NO_RESERVED_ALLOCATION"] = "no-reserved-allocation";
|
|
365
|
+
PrePurchaseFailureReason2["SALE_NOT_ACTIVE"] = "sale-not-active";
|
|
366
|
+
PrePurchaseFailureReason2["WALLET_NOT_LINKED"] = "wallet-not-linked";
|
|
366
367
|
return PrePurchaseFailureReason2;
|
|
367
368
|
})(PrePurchaseFailureReason || {});
|
|
369
|
+
var InvestingRegion = /* @__PURE__ */ ((InvestingRegion2) => {
|
|
370
|
+
InvestingRegion2["UNKNOWN"] = "unknown";
|
|
371
|
+
InvestingRegion2["OTHER"] = "other";
|
|
372
|
+
InvestingRegion2["US"] = "us";
|
|
373
|
+
return InvestingRegion2;
|
|
374
|
+
})(InvestingRegion || {});
|
|
368
375
|
|
|
369
376
|
// src/index.ts
|
|
370
377
|
var DEFAULT_API_URL = "https://api.echo.xyz";
|
|
@@ -387,6 +394,7 @@ export {
|
|
|
387
394
|
APIError,
|
|
388
395
|
EntitySetupState,
|
|
389
396
|
EntityType,
|
|
397
|
+
InvestingRegion,
|
|
390
398
|
PrePurchaseFailureReason,
|
|
391
399
|
PurchasePermitType,
|
|
392
400
|
SaleEligibility,
|