@echoxyz/sonar-core 0.1.4 → 0.2.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 +5 -4
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -71,13 +71,14 @@ export async function completeOAuthFromCallback() {
|
|
|
71
71
|
|
|
72
72
|
// Call APIs (after token is set)
|
|
73
73
|
export async function exampleCalls() {
|
|
74
|
+
const { walletAddress } = useWallet(); // User's connected wallet.
|
|
74
75
|
// List entities available to this user for the configured sale
|
|
75
|
-
const {
|
|
76
|
+
const { Entity } = await client.readEntity({ saleUUID, walletAddress });
|
|
76
77
|
|
|
77
78
|
// Run a pre-purchase check
|
|
78
79
|
const pre = await client.prePurchaseCheck({
|
|
79
80
|
saleUUID,
|
|
80
|
-
entityUUID:
|
|
81
|
+
entityUUID: Entity.EntityUUID,
|
|
81
82
|
entityType: EntityType.USER, // or EntityType.ORGANIZATION
|
|
82
83
|
walletAddress: "0x1234...abcd" as `0x${string}`,
|
|
83
84
|
});
|
|
@@ -86,7 +87,7 @@ export async function exampleCalls() {
|
|
|
86
87
|
// Generate a purchase permit
|
|
87
88
|
const permit = await client.generatePurchasePermit({
|
|
88
89
|
saleUUID,
|
|
89
|
-
entityUUID:
|
|
90
|
+
entityUUID: Entity.EntityUUID,
|
|
90
91
|
entityType: EntityType.USER,
|
|
91
92
|
walletAddress: "0x1234...abcd" as `0x${string}`,
|
|
92
93
|
});
|
|
@@ -94,7 +95,7 @@ export async function exampleCalls() {
|
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
// Fetch allocation
|
|
97
|
-
const alloc = await client.fetchAllocation({ saleUUID, walletAddress
|
|
98
|
+
const alloc = await client.fetchAllocation({ saleUUID, walletAddress });
|
|
98
99
|
console.log(alloc);
|
|
99
100
|
}
|
|
100
101
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -295,11 +295,11 @@ var SonarClient = class {
|
|
|
295
295
|
WalletAddress: args.walletAddress
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
|
-
async
|
|
299
|
-
|
|
300
|
-
SaleUUID: args.saleUUID
|
|
298
|
+
async readEntity(args) {
|
|
299
|
+
return this.postJSON("/externalapi.ReadEntity", {
|
|
300
|
+
SaleUUID: args.saleUUID,
|
|
301
|
+
WalletAddress: args.walletAddress
|
|
301
302
|
});
|
|
302
|
-
return data;
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
305
|
var APIError = class extends Error {
|
package/dist/index.d.cts
CHANGED
|
@@ -94,8 +94,8 @@ type AllocationResponse = {
|
|
|
94
94
|
ReservedAmountUSD: string;
|
|
95
95
|
MaxAmountUSD: string;
|
|
96
96
|
};
|
|
97
|
-
type
|
|
98
|
-
|
|
97
|
+
type ReadEntityResponse = {
|
|
98
|
+
Entity: EntityDetails;
|
|
99
99
|
};
|
|
100
100
|
type ClientOptions = {
|
|
101
101
|
auth?: AuthSession;
|
|
@@ -140,9 +140,10 @@ declare class SonarClient {
|
|
|
140
140
|
saleUUID: string;
|
|
141
141
|
walletAddress: string;
|
|
142
142
|
}): Promise<AllocationResponse>;
|
|
143
|
-
|
|
143
|
+
readEntity(args: {
|
|
144
144
|
saleUUID: string;
|
|
145
|
-
|
|
145
|
+
walletAddress: string;
|
|
146
|
+
}): Promise<ReadEntityResponse>;
|
|
146
147
|
}
|
|
147
148
|
declare class APIError extends Error {
|
|
148
149
|
readonly status: number;
|
|
@@ -179,4 +180,4 @@ type CreateClientOptions = {
|
|
|
179
180
|
};
|
|
180
181
|
declare function createClient(options: CreateClientOptions): SonarClient;
|
|
181
182
|
|
|
182
|
-
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
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -94,8 +94,8 @@ type AllocationResponse = {
|
|
|
94
94
|
ReservedAmountUSD: string;
|
|
95
95
|
MaxAmountUSD: string;
|
|
96
96
|
};
|
|
97
|
-
type
|
|
98
|
-
|
|
97
|
+
type ReadEntityResponse = {
|
|
98
|
+
Entity: EntityDetails;
|
|
99
99
|
};
|
|
100
100
|
type ClientOptions = {
|
|
101
101
|
auth?: AuthSession;
|
|
@@ -140,9 +140,10 @@ declare class SonarClient {
|
|
|
140
140
|
saleUUID: string;
|
|
141
141
|
walletAddress: string;
|
|
142
142
|
}): Promise<AllocationResponse>;
|
|
143
|
-
|
|
143
|
+
readEntity(args: {
|
|
144
144
|
saleUUID: string;
|
|
145
|
-
|
|
145
|
+
walletAddress: string;
|
|
146
|
+
}): Promise<ReadEntityResponse>;
|
|
146
147
|
}
|
|
147
148
|
declare class APIError extends Error {
|
|
148
149
|
readonly status: number;
|
|
@@ -179,4 +180,4 @@ type CreateClientOptions = {
|
|
|
179
180
|
};
|
|
180
181
|
declare function createClient(options: CreateClientOptions): SonarClient;
|
|
181
182
|
|
|
182
|
-
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
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -259,11 +259,11 @@ var SonarClient = class {
|
|
|
259
259
|
WalletAddress: args.walletAddress
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
|
-
async
|
|
263
|
-
|
|
264
|
-
SaleUUID: args.saleUUID
|
|
262
|
+
async readEntity(args) {
|
|
263
|
+
return this.postJSON("/externalapi.ReadEntity", {
|
|
264
|
+
SaleUUID: args.saleUUID,
|
|
265
|
+
WalletAddress: args.walletAddress
|
|
265
266
|
});
|
|
266
|
-
return data;
|
|
267
267
|
}
|
|
268
268
|
};
|
|
269
269
|
var APIError = class extends Error {
|