@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.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/backend/BackendImpl.ts +12 -9
- package/src/core/MSafeClient.ts +3 -4
- package/src/globals/MSafeGlobals.ts +1 -1
- package/src/globals/const.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -43803,8 +43803,9 @@ var import_client4 = require("@mysten/sui.js/client");
|
|
|
43803
43803
|
var import_sui3_utils44 = require("@msafe/sui3-utils");
|
|
43804
43804
|
var import_axios3 = __toESM(require("axios"), 1);
|
|
43805
43805
|
var BackendImpl = class _BackendImpl {
|
|
43806
|
-
constructor(apiURL) {
|
|
43806
|
+
constructor(apiURL, mockAddress) {
|
|
43807
43807
|
this.apiURL = apiURL;
|
|
43808
|
+
this.mockAddress = mockAddress;
|
|
43808
43809
|
}
|
|
43809
43810
|
_token;
|
|
43810
43811
|
async authSign(input) {
|
|
@@ -43992,7 +43993,7 @@ var BackendImpl = class _BackendImpl {
|
|
|
43992
43993
|
return res.data;
|
|
43993
43994
|
}
|
|
43994
43995
|
headers(token) {
|
|
43995
|
-
return { Authorization: `Bearer ${token || this._token}
|
|
43996
|
+
return { Authorization: `Bearer ${token || this._token}`, "sui-mock-user": this.mockAddress };
|
|
43996
43997
|
}
|
|
43997
43998
|
static toMSafeConfig(resp) {
|
|
43998
43999
|
return {
|
|
@@ -44190,7 +44191,7 @@ var MSafeGlobals = class _MSafeGlobals {
|
|
|
44190
44191
|
static async New(env, options) {
|
|
44191
44192
|
const config2 = getMSafeConfig(env, options);
|
|
44192
44193
|
const suiClient = new import_client4.SuiClient(config2.suiClient);
|
|
44193
|
-
const backend = new BackendImpl(config2.backend.url);
|
|
44194
|
+
const backend = new BackendImpl(config2.backend.url, options?.mockAddress);
|
|
44194
44195
|
return new _MSafeGlobals({
|
|
44195
44196
|
backend,
|
|
44196
44197
|
suiClient,
|
|
@@ -44231,12 +44232,12 @@ var MSafeClient = class _MSafeClient {
|
|
|
44231
44232
|
return input.jwtToken;
|
|
44232
44233
|
}
|
|
44233
44234
|
}
|
|
44234
|
-
const jwt = await this.authSign(input.wallet
|
|
44235
|
+
const jwt = await this.authSign(input.wallet);
|
|
44235
44236
|
this.globals.wallet = input.wallet;
|
|
44236
44237
|
this.backend.setJWTToken(jwt);
|
|
44237
44238
|
return jwt;
|
|
44238
44239
|
}
|
|
44239
|
-
async authSign(wallet
|
|
44240
|
+
async authSign(wallet) {
|
|
44240
44241
|
const messageStr = import_sui3_utils45.SigningMessageHelper.loginMessageWithTimestamp((/* @__PURE__ */ new Date()).toUTCString());
|
|
44241
44242
|
const sig = await wallet.signPersonalMessage({
|
|
44242
44243
|
messageStr
|
|
@@ -44245,8 +44246,7 @@ var MSafeClient = class _MSafeClient {
|
|
|
44245
44246
|
address: await wallet.address(),
|
|
44246
44247
|
message: messageStr,
|
|
44247
44248
|
signature: sig.signature,
|
|
44248
|
-
walletType: wallet.walletType
|
|
44249
|
-
mockAddress
|
|
44249
|
+
walletType: wallet.walletType
|
|
44250
44250
|
});
|
|
44251
44251
|
}
|
|
44252
44252
|
async userInfo() {
|