@openfort/openfort-js 0.8.2 → 0.8.3

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/dist/index.cjs CHANGED
@@ -3207,7 +3207,7 @@ class KeyPair extends signingKey.SigningKey {
3207
3207
  }
3208
3208
  }
3209
3209
 
3210
- const VERSION = '0.8.2';
3210
+ const VERSION = '0.8.3';
3211
3211
 
3212
3212
  var Event;
3213
3213
  (function (Event) {
@@ -6275,9 +6275,9 @@ class Openfort {
6275
6275
  * @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
6276
6276
  * @returns An AuthResponse object containing authentication details.
6277
6277
  */
6278
- async signUpWithEmailPassword({ email, password, ecosystemGame }) {
6278
+ async signUpWithEmailPassword({ email, password, options, ecosystemGame, }) {
6279
6279
  const previousAuth = Authentication.fromStorage(this.storage);
6280
- const result = await this.authManager.signupEmailPassword(email, password, ecosystemGame);
6280
+ const result = await this.authManager.signupEmailPassword(email, password, options?.data.name, ecosystemGame);
6281
6281
  if (previousAuth && previousAuth.player !== result.player.id) {
6282
6282
  this.logout();
6283
6283
  }
@@ -6520,6 +6520,17 @@ class Openfort {
6520
6520
  const result = await this.backendApiClients.transactionIntentsApi.signature(request);
6521
6521
  return result.data;
6522
6522
  }
6523
+ async getAccount() {
6524
+ const account = Account.fromStorage(this.storage);
6525
+ if (!account) {
6526
+ throw new OpenfortError('No signer configured', exports.OpenfortErrorType.MISSING_SIGNER_ERROR);
6527
+ }
6528
+ return {
6529
+ chainId: account.chainId,
6530
+ address: account.address,
6531
+ accountType: account.type,
6532
+ };
6533
+ }
6523
6534
  // eslint-disable-next-line class-methods-use-this
6524
6535
  get backendApiClients() {
6525
6536
  const configuration = Configuration.fromStorage();
package/dist/index.d.ts CHANGED
@@ -75,6 +75,20 @@ type SessionKey = {
75
75
  address: string;
76
76
  isRegistered: boolean;
77
77
  };
78
+ type CurrentAccount = {
79
+ address: string;
80
+ accountType: AccountType;
81
+ chainId: number;
82
+ };
83
+ declare enum AccountType {
84
+ UPGRADEABLE_V4 = "Upgradeable_v04",
85
+ MANAGED_V4 = "Managed_v04",
86
+ ERC6551_V4 = "ERC6551_v04",
87
+ ERC6551_V5 = "ERC6551_v05",
88
+ RECOVERABLE_V4 = "Recoverable_v04",
89
+ MANAGED_V5 = "Managed_v05",
90
+ UPGRADEABLE_V5 = "Upgradeable_v05"
91
+ }
78
92
  declare enum AuthType {
79
93
  OPENFORT = "openfort",
80
94
  THIRD_PARTY = "thirdParty"
@@ -603,9 +617,14 @@ declare class Openfort {
603
617
  * @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
604
618
  * @returns An AuthResponse object containing authentication details.
605
619
  */
606
- signUpWithEmailPassword({ email, password, ecosystemGame }: {
620
+ signUpWithEmailPassword({ email, password, options, ecosystemGame, }: {
607
621
  email: string;
608
622
  password: string;
623
+ options?: {
624
+ data: {
625
+ name: string;
626
+ };
627
+ };
609
628
  ecosystemGame?: string;
610
629
  }): Promise<AuthResponse>;
611
630
  /**
@@ -808,6 +827,7 @@ declare class Openfort {
808
827
  * @throws {OpenfortError} If no userOperationHash or signature is provided.
809
828
  */
810
829
  sendSignatureTransactionIntentRequest(transactionIntentId: string, userOperationHash?: string | null, signature?: string | null, optimistic?: boolean): Promise<TransactionIntentResponse>;
830
+ getAccount(): Promise<CurrentAccount>;
811
831
  private get backendApiClients();
812
832
  /**
813
833
  * Sends a transaction signed with a session request.
package/dist/index.js CHANGED
@@ -3184,7 +3184,7 @@ class KeyPair extends SigningKey {
3184
3184
  }
3185
3185
  }
3186
3186
 
3187
- const VERSION = '0.8.2';
3187
+ const VERSION = '0.8.3';
3188
3188
 
3189
3189
  var Event;
3190
3190
  (function (Event) {
@@ -6252,9 +6252,9 @@ class Openfort {
6252
6252
  * @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
6253
6253
  * @returns An AuthResponse object containing authentication details.
6254
6254
  */
6255
- async signUpWithEmailPassword({ email, password, ecosystemGame }) {
6255
+ async signUpWithEmailPassword({ email, password, options, ecosystemGame, }) {
6256
6256
  const previousAuth = Authentication.fromStorage(this.storage);
6257
- const result = await this.authManager.signupEmailPassword(email, password, ecosystemGame);
6257
+ const result = await this.authManager.signupEmailPassword(email, password, options?.data.name, ecosystemGame);
6258
6258
  if (previousAuth && previousAuth.player !== result.player.id) {
6259
6259
  this.logout();
6260
6260
  }
@@ -6497,6 +6497,17 @@ class Openfort {
6497
6497
  const result = await this.backendApiClients.transactionIntentsApi.signature(request);
6498
6498
  return result.data;
6499
6499
  }
6500
+ async getAccount() {
6501
+ const account = Account.fromStorage(this.storage);
6502
+ if (!account) {
6503
+ throw new OpenfortError('No signer configured', OpenfortErrorType.MISSING_SIGNER_ERROR);
6504
+ }
6505
+ return {
6506
+ chainId: account.chainId,
6507
+ address: account.address,
6508
+ accountType: account.type,
6509
+ };
6510
+ }
6500
6511
  // eslint-disable-next-line class-methods-use-this
6501
6512
  get backendApiClients() {
6502
6513
  const configuration = Configuration.fromStorage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfort/openfort-js",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "author": "Openfort (https://www.openfort.xyz)",
5
5
  "bugs": "https://github.com/openfort-xyz/openfort-js/issues",
6
6
  "repository": "openfort-xyz/openfort-js.git",