@msafe/sui3-sdk 0.0.40 → 0.0.42-pre-bbd6acd.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@msafe/sui3-sdk",
3
- "version": "0.0.40",
3
+ "version": "0.0.42-pre-bbd6acd.0",
4
4
  "description": "SDK for MSafe SUI V3",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -21,13 +21,13 @@
21
21
  "author": "MSafe <admin@m-safe.io>",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@msafe/sui-app-store": "^0.0.10",
25
- "@msafe/sui3-utils": "^3.1.44",
24
+ "@msafe/sui-wallet": "^0.0.22",
25
+ "@msafe/sui3-utils": "^3.1.51",
26
26
  "axios": "^1.6.6",
27
27
  "buffer": "^6.0.3"
28
28
  },
29
29
  "devDependencies": {
30
- "@mysten/sui.js": "^0.46.1",
30
+ "@mysten/sui.js": "^0.50.1",
31
31
  "@types/jest": "^29.5.8",
32
32
  "@types/node": "^20.9.2",
33
33
  "@typescript-eslint/eslint-plugin": "^6.5.0",
@@ -59,6 +59,7 @@
59
59
  "lint": "eslint . --ext .ts,.tsx",
60
60
  "build": "yarn clean && yarn _build:node",
61
61
  "_build:node": "tsup --format cjs,esm --dts",
62
+ "build-yalc": "yarn build && yalc publish --private",
62
63
  "prerelease": "yarn build && chmod +x ./scripts/prerelease.sh && ./scripts/prerelease.sh"
63
64
  },
64
65
  "peerDependencies": {
@@ -35,9 +35,10 @@ import {
35
35
  ISetAddressBookModeReq,
36
36
  IRejectTransactionRequest,
37
37
  IProposeIntentionAndBuildAndVoteRequest,
38
+ IGetDashboardReq,
39
+ IGetDashboardResp,
38
40
  } from '@msafe/sui3-utils';
39
- import { SerializedSignature } from '@mysten/sui.js/cryptography';
40
- import { PublicKey } from '@mysten/sui.js/src/cryptography';
41
+ import { SerializedSignature, PublicKey } from '@mysten/sui.js/cryptography';
41
42
  import axios, { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
42
43
 
43
44
  import { IBackend } from '@/backend/interface';
@@ -265,6 +266,14 @@ export class BackendImpl implements IBackend {
265
266
  await this.post('/report', report);
266
267
  }
267
268
 
269
+ async getDashboard(input: IGetDashboardReq): Promise<IGetDashboardResp> {
270
+ const res = await this.get<IGetDashboardResp>('/dashboard', {
271
+ params: input,
272
+ headers: this.headers(),
273
+ });
274
+ return res.data;
275
+ }
276
+
268
277
  private headers(token?: string) {
269
278
  return { Authorization: `Bearer ${token || this._token}` };
270
279
  }
@@ -27,6 +27,8 @@ import {
27
27
  ISetAddressBookModeReq,
28
28
  IRejectTransactionRequest,
29
29
  IProposeIntentionAndBuildAndVoteRequest,
30
+ IGetDashboardResp,
31
+ IGetDashboardReq,
30
32
  } from '@msafe/sui3-utils';
31
33
  import { PublicKey, SerializedSignature } from '@mysten/sui.js/cryptography';
32
34
 
@@ -73,4 +75,6 @@ export interface IBackend {
73
75
  setAddressBookMode(input: ISetAddressBookModeReq): Promise<void>;
74
76
 
75
77
  submitReport(report: Report): Promise<void>;
78
+
79
+ getDashboard(input: IGetDashboardReq): Promise<IGetDashboardResp>;
76
80
  }
@@ -16,9 +16,8 @@ import {
16
16
  buildRejectTxb,
17
17
  isSameAddress,
18
18
  } from '@msafe/sui3-utils';
19
- import { SuiObjectData } from '@mysten/sui.js/client';
19
+ import { SuiObjectData, SuiObjectResponse } from '@mysten/sui.js/client';
20
20
  import { SerializedSignature } from '@mysten/sui.js/cryptography';
21
- import { SuiObjectResponse } from '@mysten/sui.js/src/client';
22
21
  import { TransactionBlock } from '@mysten/sui.js/transactions';
23
22
  import { normalizeStructTag } from '@mysten/sui.js/utils';
24
23
 
@@ -94,11 +93,9 @@ export class MSafeAccount {
94
93
  const rejectPending = res.reject;
95
94
 
96
95
  return {
97
- txType: TransactionType.Assets,
98
- txSubType:
99
- 'coinType' in pendingTx.intention
100
- ? TransactionSubTypes.assets.coin.send
101
- : TransactionSubTypes.assets.object.send,
96
+ application: pendingTx.application,
97
+ txType: pendingTx.txType,
98
+ txSubType: pendingTx.txSubType,
102
99
  createdAt: pendingTx.createdAt as Date,
103
100
  creator: pendingTx.creator,
104
101
  digest: pendingTx.digest,
@@ -140,6 +137,7 @@ export class MSafeAccount {
140
137
  throw new Error(`Can't find app helper for application ${request.application}`);
141
138
  }
142
139
  const txb = await appHelper.build({
140
+ network: 'sui:testnet',
143
141
  intentionData: request.intention,
144
142
  txType: request.txType,
145
143
  txSubType: request.txSubType,
@@ -320,12 +318,13 @@ export class MSafeAccount {
320
318
 
321
319
  async simulateBuildTransaction(): Promise<SimulationResult> {
322
320
  const intention = await this.backend.getNextIntention({ msafeAddress: this.address });
323
-
321
+ console.log('🚀 ~ MSafeAccount ~ simulateBuildTransaction ~ appHelper:', appHelpers.apps);
324
322
  const appHelper = appHelpers.getAppHelper(intention.application);
325
323
  if (!appHelper) {
326
324
  throw new Error(`Can't find app helper for application ${intention.application}`);
327
325
  }
328
326
  const txb = await appHelper.build({
327
+ network: 'sui:testnet',
329
328
  intentionData: intention.intention,
330
329
  txType: intention.txType as TransactionType,
331
330
  txSubType: intention.txSubType,
@@ -375,6 +374,13 @@ export class MSafeAccount {
375
374
  });
376
375
  }
377
376
 
377
+ async dashboard(timezone?: string) {
378
+ return this.backend.getDashboard({
379
+ msafeAddress: this.address,
380
+ // timezone,
381
+ });
382
+ }
383
+
378
384
  private calculateWeightFromVotes(votes: { userAddress: string }[]) {
379
385
  return this.calculateWeight(votes.map((vote) => vote.userAddress));
380
386
  }
@@ -1,5 +1,5 @@
1
1
  import { isSameAddress } from '@msafe/sui3-utils';
2
- import { PublicKey } from '@mysten/sui.js/src/cryptography';
2
+ import { PublicKey } from '@mysten/sui.js/cryptography';
3
3
  import { normalizeSuiAddress } from '@mysten/sui.js/utils';
4
4
 
5
5
  import { MSafeGlobals } from '@/globals/MSafeGlobals';
@@ -32,7 +32,7 @@ export const LOCAL_API_URL = 'http://127.0.0.1:3000';
32
32
  export const LOCAL_SYNCING_URL = 'http://127.0.0.1:3001';
33
33
 
34
34
  export const DEV_API_URL = 'https://sui-dev.m-safe.link';
35
- export const DEV_SYNCING_URL = 'http://52.53.228.20';
35
+ export const DEV_SYNCING_URL = 'http://13.56.226.148:81';
36
36
 
37
37
  export const PREV_API_URL = 'https://sui-preview.m-safe.link';
38
38
 
@@ -3,6 +3,7 @@ import { GasCostSummary, SuiObjectRef } from '@mysten/sui.js/client';
3
3
  import { SerializedSignature } from '@mysten/sui.js/cryptography';
4
4
 
5
5
  export interface PendingTx {
6
+ application: string;
6
7
  txType: TransactionType;
7
8
  txSubType: string;
8
9
  digest: string;
@@ -3,7 +3,7 @@ import {
3
3
  SuiTransactionBlockResponseOptions,
4
4
  SuiTransactionBlockResponse,
5
5
  } from '@mysten/sui.js/client';
6
- import { SignatureWithBytes } from '@mysten/sui.js/src/cryptography/keypair';
6
+ import { SignatureWithBytes } from '@mysten/sui.js/cryptography';
7
7
  import { TransactionBlock } from '@mysten/sui.js/transactions';
8
8
 
9
9
  export interface IWallet {