@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.cjs +15 -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 +15 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/backend/BackendImpl.ts +20 -9
- package/src/core/MSafeClient.ts +2 -3
- 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) {
|
|
@@ -44010,7 +44011,12 @@ var BackendImpl = class _BackendImpl {
|
|
|
44010
44011
|
async get(url, config2) {
|
|
44011
44012
|
const fullUrl = this.getFullUrl(url);
|
|
44012
44013
|
try {
|
|
44013
|
-
return await import_axios3.default.get(fullUrl,
|
|
44014
|
+
return await import_axios3.default.get(fullUrl, {
|
|
44015
|
+
...config2,
|
|
44016
|
+
headers: {
|
|
44017
|
+
"sui-mock-user": this.mockAddress
|
|
44018
|
+
}
|
|
44019
|
+
});
|
|
44014
44020
|
} catch (e) {
|
|
44015
44021
|
throw BackendError.fromError(e) ?? e;
|
|
44016
44022
|
}
|
|
@@ -44020,7 +44026,10 @@ var BackendImpl = class _BackendImpl {
|
|
|
44020
44026
|
try {
|
|
44021
44027
|
return await import_axios3.default.post(fullUrl, data, {
|
|
44022
44028
|
...config2,
|
|
44023
|
-
transformRequest: this.getTransformRequest()
|
|
44029
|
+
transformRequest: this.getTransformRequest(),
|
|
44030
|
+
headers: {
|
|
44031
|
+
"sui-mock-user": this.mockAddress
|
|
44032
|
+
}
|
|
44024
44033
|
});
|
|
44025
44034
|
} catch (e) {
|
|
44026
44035
|
throw BackendError.fromError(e) ?? e;
|
|
@@ -44190,7 +44199,7 @@ var MSafeGlobals = class _MSafeGlobals {
|
|
|
44190
44199
|
static async New(env, options) {
|
|
44191
44200
|
const config2 = getMSafeConfig(env, options);
|
|
44192
44201
|
const suiClient = new import_client4.SuiClient(config2.suiClient);
|
|
44193
|
-
const backend = new BackendImpl(config2.backend.url);
|
|
44202
|
+
const backend = new BackendImpl(config2.backend.url, options?.mockAddress);
|
|
44194
44203
|
return new _MSafeGlobals({
|
|
44195
44204
|
backend,
|
|
44196
44205
|
suiClient,
|
|
@@ -44236,7 +44245,7 @@ var MSafeClient = class _MSafeClient {
|
|
|
44236
44245
|
this.backend.setJWTToken(jwt);
|
|
44237
44246
|
return jwt;
|
|
44238
44247
|
}
|
|
44239
|
-
async authSign(wallet
|
|
44248
|
+
async authSign(wallet) {
|
|
44240
44249
|
const messageStr = import_sui3_utils45.SigningMessageHelper.loginMessageWithTimestamp((/* @__PURE__ */ new Date()).toUTCString());
|
|
44241
44250
|
const sig = await wallet.signPersonalMessage({
|
|
44242
44251
|
messageStr
|
|
@@ -44245,8 +44254,7 @@ var MSafeClient = class _MSafeClient {
|
|
|
44245
44254
|
address: await wallet.address(),
|
|
44246
44255
|
message: messageStr,
|
|
44247
44256
|
signature: sig.signature,
|
|
44248
|
-
walletType: wallet.walletType
|
|
44249
|
-
mockAddress
|
|
44257
|
+
walletType: wallet.walletType
|
|
44250
44258
|
});
|
|
44251
44259
|
}
|
|
44252
44260
|
async userInfo() {
|