@msafe/sui3-sdk 0.0.40-pre-66cfd8e.0 → 0.0.41

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
@@ -1,9 +1,12 @@
1
+ import * as _mysten_sui_js_src_cryptography from '@mysten/sui.js/src/cryptography';
2
+ import { PublicKey as PublicKey$1 } from '@mysten/sui.js/src/cryptography';
1
3
  import * as _msafe_sui3_utils from '@msafe/sui3-utils';
2
- import { IAuthLoginReq, JWTToken, IMSafeConfig, IUserInfoResp, UserMSafeStatus, IPageOptions, IPagedResult, IGetPendingTransactionRequest, GetPendingTransactionResponse, IGetHistoryTransactionsRequest, GetHistoryTransactionsResponse, IGetIntentionsRequest, GetTransactionIntentionsResponse, IMSafeAddressRequest, TransactionIntentionItem, ICreateMSafeReq, IProposeIntentionRequest, TxIntention, IRejectTransactionRequest, IVoteTransactionRequest, IBuildTransactionRequest, ISkipIntentionRequest, IProposeIntentionAndBuildAndVoteRequest, IGetAddressBookResult, UpdateAddressBookEntry, IGetAddressBookModeResult, ISetAddressBookModeReq, Report, TransactionType, IGasOption, PublicKeyWithSchema, AddressBookMode, MultiSigAccount, CoinTransferIntention, ObjectTransferIntention, PlainPayloadIntention } from '@msafe/sui3-utils';
3
- import * as _mysten_sui_js_cryptography from '@mysten/sui.js/cryptography';
4
- import { PublicKey, SerializedSignature, SignatureWithBytes } from '@mysten/sui.js/cryptography';
4
+ import { IAuthLoginReq, JWTToken, IMSafeConfig, IUserInfoResp, UserMSafeStatus, IPageOptions, IPagedResult, IGetPendingTransactionRequest, GetPendingTransactionResponse, IGetHistoryTransactionsRequest, GetHistoryTransactionsResponse, IGetIntentionsRequest, GetTransactionIntentionsResponse, IMSafeAddressRequest, TransactionIntentionItem, ICreateMSafeReq, IProposeIntentionRequest, TxIntention, IRejectTransactionRequest, IVoteTransactionRequest, IBuildTransactionRequest, ISkipIntentionRequest, IProposeIntentionAndBuildAndVoteRequest, IGetAddressBookResult, UpdateAddressBookEntry, IGetAddressBookModeResult, ISetAddressBookModeReq, Report, IGetDashboardReq, IGetDashboardResp, TransactionType, IGasOption, PublicKeyWithSchema, AddressBookMode, MultiSigAccount, CoinTransferIntention, ObjectTransferIntention, PlainPayloadIntention } from '@msafe/sui3-utils';
5
5
  import * as _mysten_sui_js_client from '@mysten/sui.js/client';
6
6
  import { ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions, SuiTransactionBlockResponse, SuiClient, GasCostSummary, SuiObjectRef, CoinMetadata, SuiObjectDataOptions, SuiObjectResponse, SuiObjectData, CoinStruct } from '@mysten/sui.js/client';
7
+ import * as _mysten_sui_js_cryptography from '@mysten/sui.js/cryptography';
8
+ import { PublicKey, SerializedSignature } from '@mysten/sui.js/cryptography';
9
+ import { SignatureWithBytes } from '@mysten/sui.js/src/cryptography/keypair';
7
10
  import { TransactionBlock } from '@mysten/sui.js/transactions';
8
11
  import { Buffer } from 'buffer';
9
12
 
@@ -51,6 +54,7 @@ interface IBackend {
51
54
  getAddressBookMode(): Promise<IGetAddressBookModeResult>;
52
55
  setAddressBookMode(input: ISetAddressBookModeReq): Promise<void>;
53
56
  submitReport(report: Report): Promise<void>;
57
+ getDashboard(input: IGetDashboardReq): Promise<IGetDashboardResp>;
54
58
  }
55
59
 
56
60
  declare enum MSafeEnv {
@@ -82,7 +86,9 @@ declare const MAINNET_RPC_URL = "https://sui-mainnet.blockvision.org/v1/2Sgk7NPv
82
86
  declare const LOCAL_API_URL = "http://127.0.0.1:3000";
83
87
  declare const LOCAL_SYNCING_URL = "http://127.0.0.1:3001";
84
88
  declare const DEV_API_URL = "https://sui-dev.m-safe.link";
85
- declare const DEV_SYNCING_URL = "http://52.53.228.20";
89
+ declare const DEV_SYNCING_URL = "http://13.56.226.148:81";
90
+ declare const PREV_API_URL = "https://sui-preview.m-safe.link";
91
+ declare const PROD_API_URL = "https://sui.m-safe.link";
86
92
  declare const ENV_CONFIGS: Map<MSafeEnv, MSafeConfig>;
87
93
  declare function getMSafeConfig(env: MSafeEnv, options?: MSafeConfigOptions): MSafeConfig;
88
94
 
@@ -126,9 +132,9 @@ declare class PublicKeyHelper {
126
132
  readonly globals: MSafeGlobals;
127
133
  private knownPublicKeys;
128
134
  constructor(globals: MSafeGlobals);
129
- getPublicKey(address: string): Promise<PublicKey | undefined>;
130
- getPublicKeyBatch(addresses: string[]): Promise<(PublicKey | undefined)[]>;
131
- addPublicKey(address: string, publicKey: PublicKey): void;
135
+ getPublicKey(address: string): Promise<PublicKey$1 | undefined>;
136
+ getPublicKeyBatch(addresses: string[]): Promise<(PublicKey$1 | undefined)[]>;
137
+ addPublicKey(address: string, publicKey: PublicKey$1): void;
132
138
  private _getPublicKey;
133
139
  private getPublicKeyFromBackend;
134
140
  private getPublicKeyFromChain;
@@ -233,7 +239,7 @@ declare class CreateHelper {
233
239
  readonly globals: MSafeGlobals;
234
240
  readonly pkHelper: PublicKeyHelper;
235
241
  constructor(globals: MSafeGlobals, pkHelper: PublicKeyHelper);
236
- getPublicKeyBatch(addresses: string[]): Promise<(PublicKey | undefined)[]>;
242
+ getPublicKeyBatch(addresses: string[]): Promise<(_mysten_sui_js_src_cryptography.PublicKey | undefined)[]>;
237
243
  calculateMSafeAddress(info: CreateMSafeInfo): Promise<string>;
238
244
  validateCreateInfo(createInfo: CreateMSafeInfo): Promise<string>;
239
245
  /**
@@ -315,6 +321,7 @@ declare class MSafeAccount {
315
321
  }): Promise<void>;
316
322
  skipNextFailedIntention(): Promise<void>;
317
323
  executePendingTx(pending: PendingTx, isRejectTx?: boolean): Promise<_mysten_sui_js_client.SuiTransactionBlockResponse>;
324
+ dashboard(timezone?: string): Promise<_msafe_sui3_utils.IGetDashboardResp>;
318
325
  private calculateWeightFromVotes;
319
326
  private calculateWeight;
320
327
  get address(): string;
@@ -420,4 +427,4 @@ declare class Coin {
420
427
  static getBalance(data: SuiObjectData): bigint | undefined;
421
428
  }
422
429
 
423
- export { AddressBookSDK, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeInfo, DEV_API_URL, DEV_SYNCING_URL, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, LOCAL_API_URL, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, type Pagination, type PendingTx, type PendingVote, type ProposeIntention, type ReceiveTransaction, SUI_COIN, SignatureVerifier, type SimulationOption, type SimulationResult, TESTNET_RPC_URL, Uint8ArrayToHex, addPrefix, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
430
+ export { AddressBookSDK, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeInfo, DEV_API_URL, DEV_SYNCING_URL, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, LOCAL_API_URL, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, PREV_API_URL, PROD_API_URL, type Pagination, type PendingTx, type PendingVote, type ProposeIntention, type ReceiveTransaction, SUI_COIN, SignatureVerifier, type SimulationOption, type SimulationResult, TESTNET_RPC_URL, Uint8ArrayToHex, addPrefix, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,12 @@
1
+ import * as _mysten_sui_js_src_cryptography from '@mysten/sui.js/src/cryptography';
2
+ import { PublicKey as PublicKey$1 } from '@mysten/sui.js/src/cryptography';
1
3
  import * as _msafe_sui3_utils from '@msafe/sui3-utils';
2
- import { IAuthLoginReq, JWTToken, IMSafeConfig, IUserInfoResp, UserMSafeStatus, IPageOptions, IPagedResult, IGetPendingTransactionRequest, GetPendingTransactionResponse, IGetHistoryTransactionsRequest, GetHistoryTransactionsResponse, IGetIntentionsRequest, GetTransactionIntentionsResponse, IMSafeAddressRequest, TransactionIntentionItem, ICreateMSafeReq, IProposeIntentionRequest, TxIntention, IRejectTransactionRequest, IVoteTransactionRequest, IBuildTransactionRequest, ISkipIntentionRequest, IProposeIntentionAndBuildAndVoteRequest, IGetAddressBookResult, UpdateAddressBookEntry, IGetAddressBookModeResult, ISetAddressBookModeReq, Report, TransactionType, IGasOption, PublicKeyWithSchema, AddressBookMode, MultiSigAccount, CoinTransferIntention, ObjectTransferIntention, PlainPayloadIntention } from '@msafe/sui3-utils';
3
- import * as _mysten_sui_js_cryptography from '@mysten/sui.js/cryptography';
4
- import { PublicKey, SerializedSignature, SignatureWithBytes } from '@mysten/sui.js/cryptography';
4
+ import { IAuthLoginReq, JWTToken, IMSafeConfig, IUserInfoResp, UserMSafeStatus, IPageOptions, IPagedResult, IGetPendingTransactionRequest, GetPendingTransactionResponse, IGetHistoryTransactionsRequest, GetHistoryTransactionsResponse, IGetIntentionsRequest, GetTransactionIntentionsResponse, IMSafeAddressRequest, TransactionIntentionItem, ICreateMSafeReq, IProposeIntentionRequest, TxIntention, IRejectTransactionRequest, IVoteTransactionRequest, IBuildTransactionRequest, ISkipIntentionRequest, IProposeIntentionAndBuildAndVoteRequest, IGetAddressBookResult, UpdateAddressBookEntry, IGetAddressBookModeResult, ISetAddressBookModeReq, Report, IGetDashboardReq, IGetDashboardResp, TransactionType, IGasOption, PublicKeyWithSchema, AddressBookMode, MultiSigAccount, CoinTransferIntention, ObjectTransferIntention, PlainPayloadIntention } from '@msafe/sui3-utils';
5
5
  import * as _mysten_sui_js_client from '@mysten/sui.js/client';
6
6
  import { ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions, SuiTransactionBlockResponse, SuiClient, GasCostSummary, SuiObjectRef, CoinMetadata, SuiObjectDataOptions, SuiObjectResponse, SuiObjectData, CoinStruct } from '@mysten/sui.js/client';
7
+ import * as _mysten_sui_js_cryptography from '@mysten/sui.js/cryptography';
8
+ import { PublicKey, SerializedSignature } from '@mysten/sui.js/cryptography';
9
+ import { SignatureWithBytes } from '@mysten/sui.js/src/cryptography/keypair';
7
10
  import { TransactionBlock } from '@mysten/sui.js/transactions';
8
11
  import { Buffer } from 'buffer';
9
12
 
@@ -51,6 +54,7 @@ interface IBackend {
51
54
  getAddressBookMode(): Promise<IGetAddressBookModeResult>;
52
55
  setAddressBookMode(input: ISetAddressBookModeReq): Promise<void>;
53
56
  submitReport(report: Report): Promise<void>;
57
+ getDashboard(input: IGetDashboardReq): Promise<IGetDashboardResp>;
54
58
  }
55
59
 
56
60
  declare enum MSafeEnv {
@@ -82,7 +86,9 @@ declare const MAINNET_RPC_URL = "https://sui-mainnet.blockvision.org/v1/2Sgk7NPv
82
86
  declare const LOCAL_API_URL = "http://127.0.0.1:3000";
83
87
  declare const LOCAL_SYNCING_URL = "http://127.0.0.1:3001";
84
88
  declare const DEV_API_URL = "https://sui-dev.m-safe.link";
85
- declare const DEV_SYNCING_URL = "http://52.53.228.20";
89
+ declare const DEV_SYNCING_URL = "http://13.56.226.148:81";
90
+ declare const PREV_API_URL = "https://sui-preview.m-safe.link";
91
+ declare const PROD_API_URL = "https://sui.m-safe.link";
86
92
  declare const ENV_CONFIGS: Map<MSafeEnv, MSafeConfig>;
87
93
  declare function getMSafeConfig(env: MSafeEnv, options?: MSafeConfigOptions): MSafeConfig;
88
94
 
@@ -126,9 +132,9 @@ declare class PublicKeyHelper {
126
132
  readonly globals: MSafeGlobals;
127
133
  private knownPublicKeys;
128
134
  constructor(globals: MSafeGlobals);
129
- getPublicKey(address: string): Promise<PublicKey | undefined>;
130
- getPublicKeyBatch(addresses: string[]): Promise<(PublicKey | undefined)[]>;
131
- addPublicKey(address: string, publicKey: PublicKey): void;
135
+ getPublicKey(address: string): Promise<PublicKey$1 | undefined>;
136
+ getPublicKeyBatch(addresses: string[]): Promise<(PublicKey$1 | undefined)[]>;
137
+ addPublicKey(address: string, publicKey: PublicKey$1): void;
132
138
  private _getPublicKey;
133
139
  private getPublicKeyFromBackend;
134
140
  private getPublicKeyFromChain;
@@ -233,7 +239,7 @@ declare class CreateHelper {
233
239
  readonly globals: MSafeGlobals;
234
240
  readonly pkHelper: PublicKeyHelper;
235
241
  constructor(globals: MSafeGlobals, pkHelper: PublicKeyHelper);
236
- getPublicKeyBatch(addresses: string[]): Promise<(PublicKey | undefined)[]>;
242
+ getPublicKeyBatch(addresses: string[]): Promise<(_mysten_sui_js_src_cryptography.PublicKey | undefined)[]>;
237
243
  calculateMSafeAddress(info: CreateMSafeInfo): Promise<string>;
238
244
  validateCreateInfo(createInfo: CreateMSafeInfo): Promise<string>;
239
245
  /**
@@ -315,6 +321,7 @@ declare class MSafeAccount {
315
321
  }): Promise<void>;
316
322
  skipNextFailedIntention(): Promise<void>;
317
323
  executePendingTx(pending: PendingTx, isRejectTx?: boolean): Promise<_mysten_sui_js_client.SuiTransactionBlockResponse>;
324
+ dashboard(timezone?: string): Promise<_msafe_sui3_utils.IGetDashboardResp>;
318
325
  private calculateWeightFromVotes;
319
326
  private calculateWeight;
320
327
  get address(): string;
@@ -420,4 +427,4 @@ declare class Coin {
420
427
  static getBalance(data: SuiObjectData): bigint | undefined;
421
428
  }
422
429
 
423
- export { AddressBookSDK, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeInfo, DEV_API_URL, DEV_SYNCING_URL, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, LOCAL_API_URL, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, type Pagination, type PendingTx, type PendingVote, type ProposeIntention, type ReceiveTransaction, SUI_COIN, SignatureVerifier, type SimulationOption, type SimulationResult, TESTNET_RPC_URL, Uint8ArrayToHex, addPrefix, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
430
+ export { AddressBookSDK, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeInfo, DEV_API_URL, DEV_SYNCING_URL, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, LOCAL_API_URL, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, PREV_API_URL, PROD_API_URL, type Pagination, type PendingTx, type PendingVote, type ProposeIntention, type ReceiveTransaction, SUI_COIN, SignatureVerifier, type SimulationOption, type SimulationResult, TESTNET_RPC_URL, Uint8ArrayToHex, addPrefix, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
package/dist/index.js CHANGED
@@ -636,7 +636,6 @@ var MSafeAccount = class _MSafeAccount {
636
636
  throw new Error(`Can't find app helper for application ${request.application}`);
637
637
  }
638
638
  const txb = await appHelper.build({
639
- network: "sui:testnet",
640
639
  intentionData: request.intention,
641
640
  txType: request.txType,
642
641
  txSubType: request.txSubType,
@@ -793,13 +792,11 @@ var MSafeAccount = class _MSafeAccount {
793
792
  }
794
793
  async simulateBuildTransaction() {
795
794
  const intention = await this.backend.getNextIntention({ msafeAddress: this.address });
796
- console.log("\u{1F680} ~ MSafeAccount ~ simulateBuildTransaction ~ appHelper:", appHelpers.apps);
797
795
  const appHelper = appHelpers.getAppHelper(intention.application);
798
796
  if (!appHelper) {
799
797
  throw new Error(`Can't find app helper for application ${intention.application}`);
800
798
  }
801
799
  const txb = await appHelper.build({
802
- network: "sui:testnet",
803
800
  intentionData: intention.intention,
804
801
  txType: intention.txType,
805
802
  txSubType: intention.txSubType,
@@ -843,6 +840,12 @@ var MSafeAccount = class _MSafeAccount {
843
840
  options: { showEffects: true }
844
841
  });
845
842
  }
843
+ async dashboard(timezone) {
844
+ return this.backend.getDashboard({
845
+ msafeAddress: this.address,
846
+ timezone
847
+ });
848
+ }
846
849
  calculateWeightFromVotes(votes) {
847
850
  return this.calculateWeight(votes.map((vote) => vote.userAddress));
848
851
  }
@@ -1151,6 +1154,13 @@ var BackendImpl = class _BackendImpl {
1151
1154
  async submitReport(report) {
1152
1155
  await this.post("/report", report);
1153
1156
  }
1157
+ async getDashboard(input) {
1158
+ const res = await this.get("/dashboard", {
1159
+ params: input,
1160
+ headers: this.headers()
1161
+ });
1162
+ return res.data;
1163
+ }
1154
1164
  headers(token) {
1155
1165
  return { Authorization: `Bearer ${token || this._token}` };
1156
1166
  }
@@ -1234,7 +1244,9 @@ var MAINNET_RPC_URL = "https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkx
1234
1244
  var LOCAL_API_URL = "http://127.0.0.1:3000";
1235
1245
  var LOCAL_SYNCING_URL = "http://127.0.0.1:3001";
1236
1246
  var DEV_API_URL = "https://sui-dev.m-safe.link";
1237
- var DEV_SYNCING_URL = "http://52.53.228.20";
1247
+ var DEV_SYNCING_URL = "http://13.56.226.148:81";
1248
+ var PREV_API_URL = "https://sui-preview.m-safe.link";
1249
+ var PROD_API_URL = "https://sui.m-safe.link";
1238
1250
  var ENV_CONFIGS = /* @__PURE__ */ new Map([
1239
1251
  [
1240
1252
  "unit" /* unit */,
@@ -1271,6 +1283,30 @@ var ENV_CONFIGS = /* @__PURE__ */ new Map([
1271
1283
  },
1272
1284
  syncingURL: DEV_SYNCING_URL
1273
1285
  }
1286
+ ],
1287
+ [
1288
+ "prev" /* prev */,
1289
+ {
1290
+ suiClient: {
1291
+ url: MAINNET_RPC_URL
1292
+ },
1293
+ backend: {
1294
+ url: PREV_API_URL
1295
+ },
1296
+ syncingURL: ""
1297
+ }
1298
+ ],
1299
+ [
1300
+ "prod" /* prod */,
1301
+ {
1302
+ suiClient: {
1303
+ url: MAINNET_RPC_URL
1304
+ },
1305
+ backend: {
1306
+ url: PROD_API_URL
1307
+ },
1308
+ syncingURL: ""
1309
+ }
1274
1310
  ]
1275
1311
  ]);
1276
1312
  function getMSafeConfig(env, options) {
@@ -1429,6 +1465,8 @@ export {
1429
1465
  MSafeClient,
1430
1466
  MSafeEnv,
1431
1467
  MSafeGlobals,
1468
+ PREV_API_URL,
1469
+ PROD_API_URL,
1432
1470
  SUI_COIN,
1433
1471
  SignatureVerifier,
1434
1472
  TESTNET_RPC_URL,