@echoxyz/sonar-core 0.1.5 → 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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @echoxyz/sonar-core
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a043774: Replace listEntities with readEntity function
8
+
3
9
  ## 0.1.5
4
10
 
5
11
  ### Patch Changes
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 { Entities } = await client.listAvailableEntities({ saleUUID });
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: Entities[0].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: Entities[0].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: "0x1234...abcd" as `0x${string}` });
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 listAvailableEntities(args) {
299
- const data = await this.postJSON("/externalapi.ListAvailableEntities", {
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 ListAvailableEntitiesResponse = {
98
- Entities: EntityDetails[];
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
- listAvailableEntities(args: {
143
+ readEntity(args: {
144
144
  saleUUID: string;
145
- }): Promise<ListAvailableEntitiesResponse>;
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 ListAvailableEntitiesResponse, type PrePurchaseCheckResponse, PrePurchaseFailureReason, type PurchasePermit, PurchasePermitType, SaleEligibility, SonarClient, type StorageLike, buildAuthorizationUrl, createClient, createMemoryStorage, createWebStorage, generatePKCEParams };
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 ListAvailableEntitiesResponse = {
98
- Entities: EntityDetails[];
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
- listAvailableEntities(args: {
143
+ readEntity(args: {
144
144
  saleUUID: string;
145
- }): Promise<ListAvailableEntitiesResponse>;
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 ListAvailableEntitiesResponse, type PrePurchaseCheckResponse, PrePurchaseFailureReason, type PurchasePermit, PurchasePermitType, SaleEligibility, SonarClient, type StorageLike, buildAuthorizationUrl, createClient, createMemoryStorage, createWebStorage, generatePKCEParams };
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 listAvailableEntities(args) {
263
- const data = await this.postJSON("/externalapi.ListAvailableEntities", {
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@echoxyz/sonar-core",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",