@msafe/sui3-sdk 0.0.9 → 0.0.11-pre-adabbed.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
@@ -10,23 +10,6 @@ import { SignatureWithBytes } from '@mysten/sui.js/src/cryptography/keypair';
10
10
  import { TransactionBlock } from '@mysten/sui.js/transactions';
11
11
  import * as _mysten_sui_js_dist_cjs_client from '@mysten/sui.js/dist/cjs/client';
12
12
 
13
- type JWTToken = string;
14
- interface PaginationOption {
15
- page?: number;
16
- pageSize: number;
17
- }
18
- interface PaginationResponse<T> {
19
- items: T[];
20
- meta: PaginationMeta;
21
- }
22
- interface PaginationMeta {
23
- totalItems: number;
24
- itemCount: number;
25
- itemsPerPage: number;
26
- totalPages: number;
27
- currentPage: number;
28
- }
29
-
30
13
  interface IntentionCoinTransfer {
31
14
  txType: 'CoinTransfer';
32
15
  recipient: string;
@@ -60,6 +43,25 @@ declare class IntentionHelper {
60
43
  }): Promise<_mysten_sui_js_dist_cjs_builder.TransactionBlock>;
61
44
  }
62
45
 
46
+ interface CreateMSafeAccountInfo {
47
+ ownerWithWeight: {
48
+ address: string;
49
+ weight: number;
50
+ }[];
51
+ threshold: number;
52
+ name: string;
53
+ description?: string;
54
+ creationNonce: number;
55
+ }
56
+ interface CreatePermissionInfo {
57
+ ownerWithWeight: {
58
+ address: string;
59
+ weight: number;
60
+ }[];
61
+ threshold: number;
62
+ creationNonce: number;
63
+ }
64
+
63
65
  interface PendingTx {
64
66
  digest: string;
65
67
  payload: string;
@@ -112,6 +114,73 @@ interface FutureIntention {
112
114
  createdAt: Date;
113
115
  }
114
116
 
117
+ interface IWallet {
118
+ walletType: string;
119
+ address(): Promise<string>;
120
+ signPersonalMessage(input: {
121
+ messageStr: string;
122
+ }): Promise<SignatureWithBytes>;
123
+ signTransactionBlock(input: {
124
+ transactionBlock: TransactionBlock | Uint8Array;
125
+ }): Promise<SignatureWithBytes>;
126
+ signAndExecuteTransactionBlock(input: {
127
+ transactionBlock: TransactionBlock;
128
+ requestType?: ExecuteTransactionRequestType;
129
+ options?: SuiTransactionBlockResponseOptions;
130
+ }): Promise<SuiTransactionBlockResponse>;
131
+ }
132
+
133
+ interface PagedResult<T> {
134
+ data: T[];
135
+ meta: PagedMeta;
136
+ }
137
+ interface PagedMeta {
138
+ page: number;
139
+ limit: number;
140
+ total: number;
141
+ hasNext: boolean;
142
+ }
143
+
144
+ declare enum OpAddressBookType {
145
+ Delete = "delete",
146
+ Upsert = "upsert"
147
+ }
148
+ type UpdateAddressBookEntry = DeleteAddressBookEntry | UpsertAddressBookEntry;
149
+ interface DeleteAddressBookEntry {
150
+ opType: OpAddressBookType.Delete;
151
+ address: string;
152
+ }
153
+ interface UpsertAddressBookEntry {
154
+ opType: OpAddressBookType.Upsert;
155
+ address: string;
156
+ addressName: string;
157
+ remark?: string;
158
+ }
159
+ type GetAddressBookResult = PagedResult<GetAddressBookResultEntry>;
160
+ interface GetAddressBookResultEntry {
161
+ address: string;
162
+ addressName: string;
163
+ remark?: string;
164
+ updatedAt: Date;
165
+ }
166
+
167
+ type JWTToken = string;
168
+ interface PaginationOption {
169
+ page?: number;
170
+ limit?: number;
171
+ }
172
+ interface PaginationResponse<T> {
173
+ items: T[];
174
+ meta: PaginationMeta;
175
+ }
176
+ interface PaginationMeta {
177
+ totalItems: number;
178
+ itemCount: number;
179
+ itemsPerPage: number;
180
+ totalPages: number;
181
+ currentPage: number;
182
+ }
183
+
115
184
  interface IBackend {
116
185
  authSign(input: AuthLoginRequest): Promise<JWTToken>;
117
186
  verifyToken(jwt?: JWTToken): Promise<boolean>;
@@ -122,7 +191,7 @@ interface IBackend {
122
191
  getUserInfo(userAddress: string): Promise<UserWithOwnedMSafe>;
123
192
  getPendingTransactions(msafeAddress: string): Promise<PendingTx[]>;
124
193
  getHistoryTransactions(msafeAddress: string, paginationOption?: PaginationOption): Promise<PaginationResponse<HistoryTransaction>>;
125
- getFutureIntentions(msafeAddress: string, paginationOption?: PaginationOption): Promise<PaginationResponse<FutureIntention>>;
194
+ getFutureIntentions(msafeAddress: string, paginationOption?: PaginationOption): Promise<PagedResult<FutureIntention>>;
126
195
  getCurrentSequenceNumber(msafeAddress: string): Promise<number>;
127
196
  getNextSequenceNumber(msafeAddress: string): Promise<number>;
128
197
  createMSafeAccount(input: CreateMSafeAccountInfoRequest): Promise<void>;
@@ -160,6 +229,11 @@ interface IBackend {
160
229
  userAddress: string;
161
230
  }): Promise<void>;
162
231
  processExecutedTransaction(digest: string): Promise<void>;
232
+ getAddressBookEntries(pagination?: PaginationOption): Promise<GetAddressBookResult>;
233
+ updateAddressBook(input: {
234
+ updates: UpdateAddressBookEntry[];
235
+ signature: SerializedSignature;
236
+ }): Promise<void>;
163
237
  }
164
238
 
165
239
  declare enum MSafeEnv {
@@ -197,22 +271,6 @@ declare const ENV_CONFIGS: Map<MSafeEnv, MSafeConfig>;
197
271
  declare function getMSafeConfig(env: MSafeEnv, options?: MSafeConfigOptions): MSafeConfig;
198
272
  declare const AUTH_SIGN_MESSAGE = "Welcome to MSafe";
199
273
 
200
- interface IWallet {
201
- walletType: string;
202
- address(): Promise<string>;
203
- signPersonalMessage(input: {
204
- messageStr: string;
205
- }): Promise<SignatureWithBytes>;
206
- signTransactionBlock(input: {
207
- transactionBlock: TransactionBlock | Uint8Array;
208
- }): Promise<SignatureWithBytes>;
209
- signAndExecuteTransactionBlock(input: {
210
- transactionBlock: TransactionBlock;
211
- requestType?: ExecuteTransactionRequestType;
212
- options?: SuiTransactionBlockResponseOptions;
213
- }): Promise<SuiTransactionBlockResponse>;
214
- }
215
-
216
274
  declare class MSafeGlobals {
217
275
  readonly backend: IBackend;
218
276
  readonly suiClient: SuiClient;
@@ -244,25 +302,6 @@ declare class PublicKeyHelper {
244
302
  private getPublicKeyFromChain;
245
303
  }
246
304
 
247
- interface CreateMSafeAccountInfo {
248
- ownerWithWeight: {
249
- address: string;
250
- weight: number;
251
- }[];
252
- threshold: number;
253
- name: string;
254
- description?: string;
255
- creationNonce: number;
256
- }
257
- interface CreatePermissionInfo {
258
- ownerWithWeight: {
259
- address: string;
260
- weight: number;
261
- }[];
262
- threshold: number;
263
- creationNonce: number;
264
- }
265
-
266
305
  declare class CreateHelper {
267
306
  readonly globals: MSafeGlobals;
268
307
  readonly pkHelper: PublicKeyHelper;
@@ -282,12 +321,20 @@ declare class MessageHelper {
282
321
  static deWelcomeMessage(msg: string): string | undefined;
283
322
  static proposeIntentionMessage(data: ProposeIntentionData): string;
284
323
  static deProposeIntentionMessage(s: string): ProposeIntentionData;
324
+ static updateAddressBookMessage(updates: UpdateAddressBookEntry[]): string;
285
325
  }
286
326
  interface ProposeIntentionData {
287
327
  intention: TxIntention;
288
328
  sn: number;
289
329
  }
290
330
 
331
+ declare class AddressBookSDK {
332
+ readonly globals: MSafeGlobals;
333
+ constructor(globals: MSafeGlobals);
334
+ getEntries(pagination?: PaginationOption): Promise<GetAddressBookResult>;
335
+ update(updates: UpdateAddressBookEntry[]): Promise<void>;
336
+ }
337
+
291
338
  declare class MSafeAccount {
292
339
  readonly globals: MSafeGlobals;
293
340
  readonly info: MSafeAccountInfo;
@@ -333,6 +380,7 @@ declare class MSafeClient {
333
380
  get config(): MSafeConfig;
334
381
  get backend(): IBackend;
335
382
  get wallet(): IWallet;
383
+ get AddressBook(): AddressBookSDK;
336
384
  private walletAddress;
337
385
  }
338
386
 
@@ -408,4 +456,4 @@ declare class Coin {
408
456
  static getBalance(data: SuiObjectData): bigint | undefined;
409
457
  }
410
458
 
411
- export { AUTH_SIGN_MESSAGE, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig, DEV_API_URL, DEV_DATABASE_CONFIG, DEV_SYNCING_URL, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, type IntentionCoinTransfer, IntentionHelper, type IntentionObjectTransfer, LOCAL_API_URL, LOCAL_DATABASE_CONFIG, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, MessageHelper, type PendingTx, type PendingVote, PublicKeySerde, type ReceiveTransaction, SUI_COIN, SignatureVerifier, TESTNET_RPC_URL, type TxIntention, UNIT_DATABASE_CONFIG, Uint8ArrayToHex, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
459
+ export { AUTH_SIGN_MESSAGE, AddressBookSDK, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig, DEV_API_URL, DEV_DATABASE_CONFIG, DEV_SYNCING_URL, type DeleteAddressBookEntry, ENV_CONFIGS, Formatter, type FutureIntention, type GetAddressBookResult, type GetAddressBookResultEntry, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, type IntentionCoinTransfer, IntentionHelper, type IntentionObjectTransfer, type JWTToken, LOCAL_API_URL, LOCAL_DATABASE_CONFIG, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, MessageHelper, OpAddressBookType, type PagedMeta, type PagedResult, type PaginationMeta, type PaginationOption, type PaginationResponse, type PendingTx, type PendingVote, PublicKeySerde, type ReceiveTransaction, SUI_COIN, SignatureVerifier, TESTNET_RPC_URL, type TxIntention, UNIT_DATABASE_CONFIG, Uint8ArrayToHex, type UpdateAddressBookEntry, type UpsertAddressBookEntry, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
package/dist/index.d.ts CHANGED
@@ -10,23 +10,6 @@ import { SignatureWithBytes } from '@mysten/sui.js/src/cryptography/keypair';
10
10
  import { TransactionBlock } from '@mysten/sui.js/transactions';
11
11
  import * as _mysten_sui_js_dist_cjs_client from '@mysten/sui.js/dist/cjs/client';
12
12
 
13
- type JWTToken = string;
14
- interface PaginationOption {
15
- page?: number;
16
- pageSize: number;
17
- }
18
- interface PaginationResponse<T> {
19
- items: T[];
20
- meta: PaginationMeta;
21
- }
22
- interface PaginationMeta {
23
- totalItems: number;
24
- itemCount: number;
25
- itemsPerPage: number;
26
- totalPages: number;
27
- currentPage: number;
28
- }
29
-
30
13
  interface IntentionCoinTransfer {
31
14
  txType: 'CoinTransfer';
32
15
  recipient: string;
@@ -60,6 +43,25 @@ declare class IntentionHelper {
60
43
  }): Promise<_mysten_sui_js_dist_cjs_builder.TransactionBlock>;
61
44
  }
62
45
 
46
+ interface CreateMSafeAccountInfo {
47
+ ownerWithWeight: {
48
+ address: string;
49
+ weight: number;
50
+ }[];
51
+ threshold: number;
52
+ name: string;
53
+ description?: string;
54
+ creationNonce: number;
55
+ }
56
+ interface CreatePermissionInfo {
57
+ ownerWithWeight: {
58
+ address: string;
59
+ weight: number;
60
+ }[];
61
+ threshold: number;
62
+ creationNonce: number;
63
+ }
64
+
63
65
  interface PendingTx {
64
66
  digest: string;
65
67
  payload: string;
@@ -112,6 +114,73 @@ interface FutureIntention {
112
114
  createdAt: Date;
113
115
  }
114
116
 
117
+ interface IWallet {
118
+ walletType: string;
119
+ address(): Promise<string>;
120
+ signPersonalMessage(input: {
121
+ messageStr: string;
122
+ }): Promise<SignatureWithBytes>;
123
+ signTransactionBlock(input: {
124
+ transactionBlock: TransactionBlock | Uint8Array;
125
+ }): Promise<SignatureWithBytes>;
126
+ signAndExecuteTransactionBlock(input: {
127
+ transactionBlock: TransactionBlock;
128
+ requestType?: ExecuteTransactionRequestType;
129
+ options?: SuiTransactionBlockResponseOptions;
130
+ }): Promise<SuiTransactionBlockResponse>;
131
+ }
132
+
133
+ interface PagedResult<T> {
134
+ data: T[];
135
+ meta: PagedMeta;
136
+ }
137
+ interface PagedMeta {
138
+ page: number;
139
+ limit: number;
140
+ total: number;
141
+ hasNext: boolean;
142
+ }
143
+
144
+ declare enum OpAddressBookType {
145
+ Delete = "delete",
146
+ Upsert = "upsert"
147
+ }
148
+ type UpdateAddressBookEntry = DeleteAddressBookEntry | UpsertAddressBookEntry;
149
+ interface DeleteAddressBookEntry {
150
+ opType: OpAddressBookType.Delete;
151
+ address: string;
152
+ }
153
+ interface UpsertAddressBookEntry {
154
+ opType: OpAddressBookType.Upsert;
155
+ address: string;
156
+ addressName: string;
157
+ remark?: string;
158
+ }
159
+ type GetAddressBookResult = PagedResult<GetAddressBookResultEntry>;
160
+ interface GetAddressBookResultEntry {
161
+ address: string;
162
+ addressName: string;
163
+ remark?: string;
164
+ updatedAt: Date;
165
+ }
166
+
167
+ type JWTToken = string;
168
+ interface PaginationOption {
169
+ page?: number;
170
+ limit?: number;
171
+ }
172
+ interface PaginationResponse<T> {
173
+ items: T[];
174
+ meta: PaginationMeta;
175
+ }
176
+ interface PaginationMeta {
177
+ totalItems: number;
178
+ itemCount: number;
179
+ itemsPerPage: number;
180
+ totalPages: number;
181
+ currentPage: number;
182
+ }
183
+
115
184
  interface IBackend {
116
185
  authSign(input: AuthLoginRequest): Promise<JWTToken>;
117
186
  verifyToken(jwt?: JWTToken): Promise<boolean>;
@@ -122,7 +191,7 @@ interface IBackend {
122
191
  getUserInfo(userAddress: string): Promise<UserWithOwnedMSafe>;
123
192
  getPendingTransactions(msafeAddress: string): Promise<PendingTx[]>;
124
193
  getHistoryTransactions(msafeAddress: string, paginationOption?: PaginationOption): Promise<PaginationResponse<HistoryTransaction>>;
125
- getFutureIntentions(msafeAddress: string, paginationOption?: PaginationOption): Promise<PaginationResponse<FutureIntention>>;
194
+ getFutureIntentions(msafeAddress: string, paginationOption?: PaginationOption): Promise<PagedResult<FutureIntention>>;
126
195
  getCurrentSequenceNumber(msafeAddress: string): Promise<number>;
127
196
  getNextSequenceNumber(msafeAddress: string): Promise<number>;
128
197
  createMSafeAccount(input: CreateMSafeAccountInfoRequest): Promise<void>;
@@ -160,6 +229,11 @@ interface IBackend {
160
229
  userAddress: string;
161
230
  }): Promise<void>;
162
231
  processExecutedTransaction(digest: string): Promise<void>;
232
+ getAddressBookEntries(pagination?: PaginationOption): Promise<GetAddressBookResult>;
233
+ updateAddressBook(input: {
234
+ updates: UpdateAddressBookEntry[];
235
+ signature: SerializedSignature;
236
+ }): Promise<void>;
163
237
  }
164
238
 
165
239
  declare enum MSafeEnv {
@@ -197,22 +271,6 @@ declare const ENV_CONFIGS: Map<MSafeEnv, MSafeConfig>;
197
271
  declare function getMSafeConfig(env: MSafeEnv, options?: MSafeConfigOptions): MSafeConfig;
198
272
  declare const AUTH_SIGN_MESSAGE = "Welcome to MSafe";
199
273
 
200
- interface IWallet {
201
- walletType: string;
202
- address(): Promise<string>;
203
- signPersonalMessage(input: {
204
- messageStr: string;
205
- }): Promise<SignatureWithBytes>;
206
- signTransactionBlock(input: {
207
- transactionBlock: TransactionBlock | Uint8Array;
208
- }): Promise<SignatureWithBytes>;
209
- signAndExecuteTransactionBlock(input: {
210
- transactionBlock: TransactionBlock;
211
- requestType?: ExecuteTransactionRequestType;
212
- options?: SuiTransactionBlockResponseOptions;
213
- }): Promise<SuiTransactionBlockResponse>;
214
- }
215
-
216
274
  declare class MSafeGlobals {
217
275
  readonly backend: IBackend;
218
276
  readonly suiClient: SuiClient;
@@ -244,25 +302,6 @@ declare class PublicKeyHelper {
244
302
  private getPublicKeyFromChain;
245
303
  }
246
304
 
247
- interface CreateMSafeAccountInfo {
248
- ownerWithWeight: {
249
- address: string;
250
- weight: number;
251
- }[];
252
- threshold: number;
253
- name: string;
254
- description?: string;
255
- creationNonce: number;
256
- }
257
- interface CreatePermissionInfo {
258
- ownerWithWeight: {
259
- address: string;
260
- weight: number;
261
- }[];
262
- threshold: number;
263
- creationNonce: number;
264
- }
265
-
266
305
  declare class CreateHelper {
267
306
  readonly globals: MSafeGlobals;
268
307
  readonly pkHelper: PublicKeyHelper;
@@ -282,12 +321,20 @@ declare class MessageHelper {
282
321
  static deWelcomeMessage(msg: string): string | undefined;
283
322
  static proposeIntentionMessage(data: ProposeIntentionData): string;
284
323
  static deProposeIntentionMessage(s: string): ProposeIntentionData;
324
+ static updateAddressBookMessage(updates: UpdateAddressBookEntry[]): string;
285
325
  }
286
326
  interface ProposeIntentionData {
287
327
  intention: TxIntention;
288
328
  sn: number;
289
329
  }
290
330
 
331
+ declare class AddressBookSDK {
332
+ readonly globals: MSafeGlobals;
333
+ constructor(globals: MSafeGlobals);
334
+ getEntries(pagination?: PaginationOption): Promise<GetAddressBookResult>;
335
+ update(updates: UpdateAddressBookEntry[]): Promise<void>;
336
+ }
337
+
291
338
  declare class MSafeAccount {
292
339
  readonly globals: MSafeGlobals;
293
340
  readonly info: MSafeAccountInfo;
@@ -333,6 +380,7 @@ declare class MSafeClient {
333
380
  get config(): MSafeConfig;
334
381
  get backend(): IBackend;
335
382
  get wallet(): IWallet;
383
+ get AddressBook(): AddressBookSDK;
336
384
  private walletAddress;
337
385
  }
338
386
 
@@ -408,4 +456,4 @@ declare class Coin {
408
456
  static getBalance(data: SuiObjectData): bigint | undefined;
409
457
  }
410
458
 
411
- export { AUTH_SIGN_MESSAGE, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig, DEV_API_URL, DEV_DATABASE_CONFIG, DEV_SYNCING_URL, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, type IntentionCoinTransfer, IntentionHelper, type IntentionObjectTransfer, LOCAL_API_URL, LOCAL_DATABASE_CONFIG, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, MessageHelper, type PendingTx, type PendingVote, PublicKeySerde, type ReceiveTransaction, SUI_COIN, SignatureVerifier, TESTNET_RPC_URL, type TxIntention, UNIT_DATABASE_CONFIG, Uint8ArrayToHex, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
459
+ export { AUTH_SIGN_MESSAGE, AddressBookSDK, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig, DEV_API_URL, DEV_DATABASE_CONFIG, DEV_SYNCING_URL, type DeleteAddressBookEntry, ENV_CONFIGS, Formatter, type FutureIntention, type GetAddressBookResult, type GetAddressBookResultEntry, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, type IntentionCoinTransfer, IntentionHelper, type IntentionObjectTransfer, type JWTToken, LOCAL_API_URL, LOCAL_DATABASE_CONFIG, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, MessageHelper, OpAddressBookType, type PagedMeta, type PagedResult, type PaginationMeta, type PaginationOption, type PaginationResponse, type PendingTx, type PendingVote, PublicKeySerde, type ReceiveTransaction, SUI_COIN, SignatureVerifier, TESTNET_RPC_URL, type TxIntention, UNIT_DATABASE_CONFIG, Uint8ArrayToHex, type UpdateAddressBookEntry, type UpsertAddressBookEntry, getAllCoins, getMSafeConfig, getPublicKeyFromChain, stringToBuffer };
package/dist/index.js CHANGED
@@ -224,6 +224,10 @@ var CreateHelper = class {
224
224
  }
225
225
  };
226
226
 
227
+ // src/core/MessageHelper.ts
228
+ import { normalizeSuiAddress as normalizeSuiAddress2 } from "@mysten/sui.js/utils";
229
+ import { MD5 } from "crypto-js";
230
+
227
231
  // src/transactions/coin-transfer.ts
228
232
  import { TransactionBlock } from "@mysten/sui.js/transactions";
229
233
 
@@ -495,6 +499,38 @@ var MessageHelper = class {
495
499
  intention: IntentionHelper.de(intentionData)
496
500
  };
497
501
  }
502
+ static updateAddressBookMessage(updates) {
503
+ const normalized = updates.map((update) => ({
504
+ ...update,
505
+ address: normalizeSuiAddress2(update.address)
506
+ }));
507
+ function sortObjectKeys(obj) {
508
+ return Object.keys(obj).sort().reduce((result, key) => ({ ...result, [key]: obj[key] }), {});
509
+ }
510
+ const sortedUpdates = normalized.map((update) => sortObjectKeys(update));
511
+ const raw = JSON.stringify(sortedUpdates, null, 2);
512
+ const encoded = stringToBuffer(raw);
513
+ if (encoded.length <= 1024) {
514
+ return raw;
515
+ }
516
+ const md5 = MD5(raw);
517
+ return `Bulk address book update: ${md5}`;
518
+ }
519
+ };
520
+
521
+ // src/core/AddressBookSDK.ts
522
+ var AddressBookSDK = class {
523
+ constructor(globals) {
524
+ this.globals = globals;
525
+ }
526
+ async getEntries(pagination) {
527
+ return this.globals.backend.getAddressBookEntries(pagination);
528
+ }
529
+ async update(updates) {
530
+ const messageStr = MessageHelper.updateAddressBookMessage(updates);
531
+ const sig = await this.globals.wallet.signPersonalMessage({ messageStr });
532
+ return this.globals.backend.updateAddressBook({ updates, signature: sig.signature });
533
+ }
498
534
  };
499
535
 
500
536
  // src/core/MSafeAccount.ts
@@ -523,7 +559,7 @@ var MSafeAccount = class _MSafeAccount {
523
559
  }
524
560
  async futureIntentions(paginationOption) {
525
561
  const paginatedIntentions = await this.backend.getFutureIntentions(this.address, paginationOption);
526
- return paginatedIntentions.items;
562
+ return paginatedIntentions.data;
527
563
  }
528
564
  async currentSequenceNumber() {
529
565
  return this.backend.getCurrentSequenceNumber(this.address);
@@ -916,7 +952,7 @@ var BackendImpl = class {
916
952
  {
917
953
  params: {
918
954
  page: paginationOption?.page,
919
- limit: paginationOption?.pageSize
955
+ limit: paginationOption?.limit
920
956
  },
921
957
  headers: this.headers()
922
958
  }
@@ -927,16 +963,13 @@ var BackendImpl = class {
927
963
  return res.data;
928
964
  }
929
965
  async getFutureIntentions(msafeAddress, paginationOption) {
930
- const res = await axios.get(
931
- `${this.apiURL}/transaction/intention/${msafeAddress}`,
932
- {
933
- params: {
934
- page: paginationOption?.page,
935
- limit: paginationOption?.pageSize
936
- },
937
- headers: this.headers()
938
- }
939
- );
966
+ const res = await axios.get(`${this.apiURL}/transaction/intention/${msafeAddress}`, {
967
+ params: {
968
+ page: paginationOption?.page,
969
+ limit: paginationOption?.limit
970
+ },
971
+ headers: this.headers()
972
+ });
940
973
  if (res.status !== 200 && res.status !== 201) {
941
974
  throw new Error(`invalid getCurrentSequenceNumber return: ${res}`);
942
975
  }
@@ -1050,6 +1083,22 @@ var BackendImpl = class {
1050
1083
  throw new Error(`invalid skipNextFailedIntention return: ${res}`);
1051
1084
  }
1052
1085
  }
1086
+ async getAddressBookEntries(pagination) {
1087
+ const res = await axios.get(`${this.apiURL}/address-book`, {
1088
+ headers: this.headers(),
1089
+ params: pagination
1090
+ });
1091
+ if (res.status !== 200) {
1092
+ throw new Error(`Invalid address-book return: ${res}`);
1093
+ }
1094
+ return res.data;
1095
+ }
1096
+ async updateAddressBook(input) {
1097
+ const res = await axios.post(`${this.apiURL}/address-book`, input, { headers: this.headers() });
1098
+ if (res.status !== 200 && res.status !== 201) {
1099
+ throw new Error(`invalid updateAddressBook return: ${res}`);
1100
+ }
1101
+ }
1053
1102
  async processExecutedTransaction(digest) {
1054
1103
  }
1055
1104
  headers(token) {
@@ -1165,12 +1214,23 @@ var MSafeClient = class _MSafeClient {
1165
1214
  get wallet() {
1166
1215
  return this.globals.wallet;
1167
1216
  }
1217
+ get AddressBook() {
1218
+ return new AddressBookSDK(this.globals);
1219
+ }
1168
1220
  async walletAddress() {
1169
1221
  return this.wallet.address();
1170
1222
  }
1171
1223
  };
1224
+
1225
+ // src/types/address-book.ts
1226
+ var OpAddressBookType = /* @__PURE__ */ ((OpAddressBookType2) => {
1227
+ OpAddressBookType2["Delete"] = "delete";
1228
+ OpAddressBookType2["Upsert"] = "upsert";
1229
+ return OpAddressBookType2;
1230
+ })(OpAddressBookType || {});
1172
1231
  export {
1173
1232
  AUTH_SIGN_MESSAGE,
1233
+ AddressBookSDK,
1174
1234
  COIN_TYPE_ARG_REGEX,
1175
1235
  Coin,
1176
1236
  CoinHelper,
@@ -1191,6 +1251,7 @@ export {
1191
1251
  MSafeEnv,
1192
1252
  MSafeGlobals,
1193
1253
  MessageHelper,
1254
+ OpAddressBookType,
1194
1255
  PublicKeySerde,
1195
1256
  SUI_COIN,
1196
1257
  SignatureVerifier,