@echoxyz/sonar-core 0.6.0 → 0.7.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,15 @@
1
1
  # @echoxyz/sonar-core
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5b96860: Add listAvailableEntities / useSonarEntities
8
+
9
+ ### Patch Changes
10
+
11
+ - ef7e0f9: Switch to new ExchangeAuthorizationCodeV2 endpoint
12
+
3
13
  ## 0.6.0
4
14
 
5
15
  ### Minor Changes
package/README.md CHANGED
@@ -71,9 +71,14 @@ export async function completeOAuthFromCallback() {
71
71
  // Call APIs (after token is set)
72
72
  export async function exampleCalls() {
73
73
  const { walletAddress } = useWallet(); // User's connected wallet.
74
- // List entities available to this user for the configured sale
74
+
75
+ // Read the entity for linked to the wallet for the configured sale.
76
+ // If the authenticated user has not yet linked the wallet on Sonar, this will return a 404.
75
77
  const { Entity } = await client.readEntity({ saleUUID, walletAddress });
76
78
 
79
+ // List entities available to this user for the configured sale
80
+ const { Entities } = await client.listAvailableEntities({ saleUUD });
81
+
77
82
  // Run a pre-purchase check
78
83
  const pre = await client.prePurchaseCheck({
79
84
  saleUUID,
package/dist/index.cjs CHANGED
@@ -265,11 +265,11 @@ var SonarClient = class {
265
265
  }
266
266
  async exchangeAuthorizationCode(args) {
267
267
  return this.postJSON(
268
- "/oauth.ExchangeAuthorizationCode",
268
+ "/oauth.ExchangeAuthorizationCodeV2",
269
269
  {
270
- Code: args.code,
271
- CodeVerifier: args.codeVerifier,
272
- RedirectURI: args.redirectURI
270
+ code: args.code,
271
+ code_verifier: args.codeVerifier,
272
+ redirect_uri: args.redirectURI
273
273
  },
274
274
  { includeAuth: false }
275
275
  );
@@ -300,6 +300,11 @@ var SonarClient = class {
300
300
  WalletAddress: args.walletAddress
301
301
  });
302
302
  }
303
+ async listAvailableEntities(args) {
304
+ return this.postJSON("/externalapi.ListAvailableEntities", {
305
+ SaleUUID: args.saleUUID
306
+ });
307
+ }
303
308
  };
304
309
  var APIError = class extends Error {
305
310
  status;
package/dist/index.d.cts CHANGED
@@ -105,6 +105,9 @@ type AllocationResponse = {
105
105
  type ReadEntityResponse = {
106
106
  Entity: EntityDetails;
107
107
  };
108
+ type ListAvailableEntitiesResponse = {
109
+ Entities: EntityDetails[];
110
+ };
108
111
  type ClientOptions = {
109
112
  auth?: AuthSession;
110
113
  fetch?: FetchLike;
@@ -150,6 +153,9 @@ declare class SonarClient {
150
153
  saleUUID: string;
151
154
  walletAddress: string;
152
155
  }): Promise<ReadEntityResponse>;
156
+ listAvailableEntities(args: {
157
+ saleUUID: string;
158
+ }): Promise<ListAvailableEntitiesResponse>;
153
159
  }
154
160
  declare class APIError extends Error {
155
161
  readonly status: number;
@@ -184,4 +190,4 @@ type CreateClientOptions = {
184
190
  };
185
191
  declare function createClient(options?: CreateClientOptions): SonarClient;
186
192
 
187
- 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 };
193
+ 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 ListAvailableEntitiesResponse, type PrePurchaseCheckResponse, PrePurchaseFailureReason, type PurchasePermit, PurchasePermitType, type ReadEntityResponse, SaleEligibility, SonarClient, type StorageLike, buildAuthorizationUrl, createClient, createMemoryStorage, createWebStorage, generatePKCEParams };
package/dist/index.d.ts CHANGED
@@ -105,6 +105,9 @@ type AllocationResponse = {
105
105
  type ReadEntityResponse = {
106
106
  Entity: EntityDetails;
107
107
  };
108
+ type ListAvailableEntitiesResponse = {
109
+ Entities: EntityDetails[];
110
+ };
108
111
  type ClientOptions = {
109
112
  auth?: AuthSession;
110
113
  fetch?: FetchLike;
@@ -150,6 +153,9 @@ declare class SonarClient {
150
153
  saleUUID: string;
151
154
  walletAddress: string;
152
155
  }): Promise<ReadEntityResponse>;
156
+ listAvailableEntities(args: {
157
+ saleUUID: string;
158
+ }): Promise<ListAvailableEntitiesResponse>;
153
159
  }
154
160
  declare class APIError extends Error {
155
161
  readonly status: number;
@@ -184,4 +190,4 @@ type CreateClientOptions = {
184
190
  };
185
191
  declare function createClient(options?: CreateClientOptions): SonarClient;
186
192
 
187
- 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 };
193
+ 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 ListAvailableEntitiesResponse, type PrePurchaseCheckResponse, PrePurchaseFailureReason, type PurchasePermit, PurchasePermitType, type ReadEntityResponse, SaleEligibility, SonarClient, type StorageLike, buildAuthorizationUrl, createClient, createMemoryStorage, createWebStorage, generatePKCEParams };
package/dist/index.js CHANGED
@@ -228,11 +228,11 @@ var SonarClient = class {
228
228
  }
229
229
  async exchangeAuthorizationCode(args) {
230
230
  return this.postJSON(
231
- "/oauth.ExchangeAuthorizationCode",
231
+ "/oauth.ExchangeAuthorizationCodeV2",
232
232
  {
233
- Code: args.code,
234
- CodeVerifier: args.codeVerifier,
235
- RedirectURI: args.redirectURI
233
+ code: args.code,
234
+ code_verifier: args.codeVerifier,
235
+ redirect_uri: args.redirectURI
236
236
  },
237
237
  { includeAuth: false }
238
238
  );
@@ -263,6 +263,11 @@ var SonarClient = class {
263
263
  WalletAddress: args.walletAddress
264
264
  });
265
265
  }
266
+ async listAvailableEntities(args) {
267
+ return this.postJSON("/externalapi.ListAvailableEntities", {
268
+ SaleUUID: args.saleUUID
269
+ });
270
+ }
266
271
  };
267
272
  var APIError = class extends Error {
268
273
  status;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@echoxyz/sonar-core",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",