@msafe/sui3-sdk 0.0.50 → 0.0.51-pre-35fa193.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/dist/index.d.cts CHANGED
@@ -78,6 +78,7 @@ interface MSafeConfigOptions {
78
78
  backend?: {
79
79
  url?: string;
80
80
  };
81
+ mockAddress?: string;
81
82
  }
82
83
  declare const TESTNET_RPC_URL = "https://fullnode.testnet.sui.io";
83
84
  declare const MAINNET_RPC_URL = "https://fullnode.mainnet.sui.io";
@@ -345,7 +346,6 @@ declare class MSafeClient {
345
346
  connectWallet(input: {
346
347
  wallet: IWallet;
347
348
  jwtToken?: JWTToken;
348
- mockAddress?: string;
349
349
  }): Promise<JWTToken>;
350
350
  private authSign;
351
351
  userInfo(): Promise<_msafe_sui3_utils.IUserInfoResp>;
package/dist/index.d.ts CHANGED
@@ -78,6 +78,7 @@ interface MSafeConfigOptions {
78
78
  backend?: {
79
79
  url?: string;
80
80
  };
81
+ mockAddress?: string;
81
82
  }
82
83
  declare const TESTNET_RPC_URL = "https://fullnode.testnet.sui.io";
83
84
  declare const MAINNET_RPC_URL = "https://fullnode.mainnet.sui.io";
@@ -345,7 +346,6 @@ declare class MSafeClient {
345
346
  connectWallet(input: {
346
347
  wallet: IWallet;
347
348
  jwtToken?: JWTToken;
348
- mockAddress?: string;
349
349
  }): Promise<JWTToken>;
350
350
  private authSign;
351
351
  userInfo(): Promise<_msafe_sui3_utils.IUserInfoResp>;
package/dist/index.js CHANGED
@@ -43796,8 +43796,9 @@ import {
43796
43796
  } from "@msafe/sui3-utils";
43797
43797
  import axios from "axios";
43798
43798
  var BackendImpl = class _BackendImpl {
43799
- constructor(apiURL) {
43799
+ constructor(apiURL, mockAddress) {
43800
43800
  this.apiURL = apiURL;
43801
+ this.mockAddress = mockAddress;
43801
43802
  }
43802
43803
  _token;
43803
43804
  async authSign(input) {
@@ -43985,7 +43986,7 @@ var BackendImpl = class _BackendImpl {
43985
43986
  return res.data;
43986
43987
  }
43987
43988
  headers(token) {
43988
- return { Authorization: `Bearer ${token || this._token}` };
43989
+ return { Authorization: `Bearer ${token || this._token}`, "sui-mock-user": this.mockAddress };
43989
43990
  }
43990
43991
  static toMSafeConfig(resp) {
43991
43992
  return {
@@ -44183,7 +44184,7 @@ var MSafeGlobals = class _MSafeGlobals {
44183
44184
  static async New(env, options) {
44184
44185
  const config2 = getMSafeConfig(env, options);
44185
44186
  const suiClient = new SuiClient3(config2.suiClient);
44186
- const backend = new BackendImpl(config2.backend.url);
44187
+ const backend = new BackendImpl(config2.backend.url, options?.mockAddress);
44187
44188
  return new _MSafeGlobals({
44188
44189
  backend,
44189
44190
  suiClient,
@@ -44224,12 +44225,12 @@ var MSafeClient = class _MSafeClient {
44224
44225
  return input.jwtToken;
44225
44226
  }
44226
44227
  }
44227
- const jwt = await this.authSign(input.wallet, input.mockAddress);
44228
+ const jwt = await this.authSign(input.wallet);
44228
44229
  this.globals.wallet = input.wallet;
44229
44230
  this.backend.setJWTToken(jwt);
44230
44231
  return jwt;
44231
44232
  }
44232
- async authSign(wallet, mockAddress) {
44233
+ async authSign(wallet) {
44233
44234
  const messageStr = SigningMessageHelper4.loginMessageWithTimestamp((/* @__PURE__ */ new Date()).toUTCString());
44234
44235
  const sig = await wallet.signPersonalMessage({
44235
44236
  messageStr
@@ -44238,8 +44239,7 @@ var MSafeClient = class _MSafeClient {
44238
44239
  address: await wallet.address(),
44239
44240
  message: messageStr,
44240
44241
  signature: sig.signature,
44241
- walletType: wallet.walletType,
44242
- mockAddress
44242
+ walletType: wallet.walletType
44243
44243
  });
44244
44244
  }
44245
44245
  async userInfo() {