@msafe/sui3-sdk 0.0.49 → 0.0.51-pre-331bbea.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) {
@@ -44003,7 +44004,12 @@ var BackendImpl = class _BackendImpl {
44003
44004
  async get(url, config2) {
44004
44005
  const fullUrl = this.getFullUrl(url);
44005
44006
  try {
44006
- return await axios.get(fullUrl, config2);
44007
+ return await axios.get(fullUrl, {
44008
+ ...config2,
44009
+ headers: {
44010
+ "sui-mock-user": this.mockAddress
44011
+ }
44012
+ });
44007
44013
  } catch (e) {
44008
44014
  throw BackendError.fromError(e) ?? e;
44009
44015
  }
@@ -44013,7 +44019,10 @@ var BackendImpl = class _BackendImpl {
44013
44019
  try {
44014
44020
  return await axios.post(fullUrl, data, {
44015
44021
  ...config2,
44016
- transformRequest: this.getTransformRequest()
44022
+ transformRequest: this.getTransformRequest(),
44023
+ headers: {
44024
+ "sui-mock-user": this.mockAddress
44025
+ }
44017
44026
  });
44018
44027
  } catch (e) {
44019
44028
  throw BackendError.fromError(e) ?? e;
@@ -44183,7 +44192,7 @@ var MSafeGlobals = class _MSafeGlobals {
44183
44192
  static async New(env, options) {
44184
44193
  const config2 = getMSafeConfig(env, options);
44185
44194
  const suiClient = new SuiClient3(config2.suiClient);
44186
- const backend = new BackendImpl(config2.backend.url);
44195
+ const backend = new BackendImpl(config2.backend.url, options?.mockAddress);
44187
44196
  return new _MSafeGlobals({
44188
44197
  backend,
44189
44198
  suiClient,
@@ -44229,7 +44238,7 @@ var MSafeClient = class _MSafeClient {
44229
44238
  this.backend.setJWTToken(jwt);
44230
44239
  return jwt;
44231
44240
  }
44232
- async authSign(wallet, mockAddress) {
44241
+ async authSign(wallet) {
44233
44242
  const messageStr = SigningMessageHelper4.loginMessageWithTimestamp((/* @__PURE__ */ new Date()).toUTCString());
44234
44243
  const sig = await wallet.signPersonalMessage({
44235
44244
  messageStr
@@ -44238,8 +44247,7 @@ var MSafeClient = class _MSafeClient {
44238
44247
  address: await wallet.address(),
44239
44248
  message: messageStr,
44240
44249
  signature: sig.signature,
44241
- walletType: wallet.walletType,
44242
- mockAddress
44250
+ walletType: wallet.walletType
44243
44251
  });
44244
44252
  }
44245
44253
  async userInfo() {