@msafe/sui3-sdk 0.0.90 → 1.0.6
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 +240 -105
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -41
- package/dist/index.d.ts +76 -41
- package/dist/index.js +240 -105
- package/dist/index.js.map +1 -1
- package/package.json +33 -19
- package/src/backend/BackendImpl.ts +3 -3
- package/src/backend/interface.ts +2 -2
- package/src/core/CreateHelper.ts +6 -6
- package/src/core/MSafeAccount.ts +76 -66
- package/src/core/PublicKeyHelper.ts +2 -2
- package/src/globals/MSafeGlobals.ts +20 -7
- package/src/globals/const.ts +21 -5
- package/src/simulate/simulator.ts +60 -17
- package/src/types/assets.ts +3 -1
- package/src/types/msafe.ts +15 -7
- package/src/types/wallet.ts +7 -12
- package/src/utils/coin.ts +20 -7
- package/src/utils/crypto.ts +8 -13
- package/src/utils/format.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/iter/object.ts +56 -43
- package/src/utils/sui.ts +71 -21
- package/src/utils/transaction.ts +12 -0
- package/tsconfig.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as _msafe_sui3_utils from '@msafe/sui3-utils';
|
|
2
2
|
import { IAuthLoginReq, JWTToken, IMSafeConfig, IUserInfoResp, UserMSafeStatus, IPageOptions, IPagedResult, IGetPendingTransactionRequest, GetPendingTransactionResponse, IGetHistoryTransactionsRequest, GetHistoryTransactionsResponse, IGetIntentionsRequest, GetTransactionIntentionsResponse, IMSafeAddressRequest, TransactionIntentionItem, ICreateMSafeReq, IProposeIntentionRequest, IRejectTransactionRequest, IVoteTransactionRequest, IBuildTransactionRequest, ISkipIntentionRequest, IProposeIntentionAndBuildAndVoteRequest, IGetAddressBookResult, UpdateAddressBookEntry, IGetAddressBookModeResult, ISetAddressBookModeReq, Report, IGetDashboardReq, IGetDashboardResp, TransactionType, TxIntention, IGasOption, PublicKeyWithSchema, AddressBookMode, MultiSigAccount, CoinTransferIntention, ObjectTransferIntention, PlainPayloadIntention } from '@msafe/sui3-utils';
|
|
3
|
-
import * as
|
|
4
|
-
import { PublicKey,
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
3
|
+
import * as _mysten_sui_cryptography from '@mysten/sui/cryptography';
|
|
4
|
+
import { PublicKey, SignatureWithBytes } from '@mysten/sui/cryptography';
|
|
5
|
+
import { RpcTransport, SuiGrpcClient } from '@mysten/sui/grpc';
|
|
6
|
+
import * as _mysten_sui_client from '@mysten/sui/client';
|
|
7
|
+
import { SuiClientTypes } from '@mysten/sui/client';
|
|
8
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
8
9
|
import { Buffer } from 'buffer';
|
|
9
10
|
|
|
10
11
|
declare enum InfoTypeKey {
|
|
@@ -78,7 +79,7 @@ interface IBackend {
|
|
|
78
79
|
getAddressBookEntries(pagination?: IPageOptions): Promise<IGetAddressBookResult>;
|
|
79
80
|
updateAddressBook(input: {
|
|
80
81
|
updates: UpdateAddressBookEntry[];
|
|
81
|
-
signature:
|
|
82
|
+
signature: string;
|
|
82
83
|
}): Promise<void>;
|
|
83
84
|
getAddressBookMode(): Promise<IGetAddressBookModeResult>;
|
|
84
85
|
setAddressBookMode(input: ISetAddressBookModeReq): Promise<void>;
|
|
@@ -89,6 +90,7 @@ interface IBackend {
|
|
|
89
90
|
updateNotificationSubscription(input: NotificationUpdateDto): Promise<void>;
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
declare function msafeChainToSuiNetwork(chain: 'sui:mainnet' | 'sui:testnet'): 'mainnet' | 'testnet';
|
|
92
94
|
declare enum MSafeEnv {
|
|
93
95
|
local = "local",
|
|
94
96
|
unit = "unit",
|
|
@@ -96,10 +98,12 @@ declare enum MSafeEnv {
|
|
|
96
98
|
prev = "prev",
|
|
97
99
|
prod = "prod"
|
|
98
100
|
}
|
|
101
|
+
/** Normalize HTTP(S) fullnode URL for SuiGrpcClient (gRPC-web) baseUrl. */
|
|
102
|
+
declare function httpUrlToGrpcBaseUrl(url: string): string;
|
|
99
103
|
interface MSafeConfig {
|
|
100
104
|
suiClient: {
|
|
101
105
|
url: string;
|
|
102
|
-
transport?:
|
|
106
|
+
transport?: RpcTransport;
|
|
103
107
|
};
|
|
104
108
|
backend: {
|
|
105
109
|
url: string;
|
|
@@ -110,7 +114,7 @@ interface MSafeConfig {
|
|
|
110
114
|
interface MSafeConfigOptions {
|
|
111
115
|
suiClient?: {
|
|
112
116
|
url: string;
|
|
113
|
-
transport?:
|
|
117
|
+
transport?: RpcTransport;
|
|
114
118
|
};
|
|
115
119
|
backend?: {
|
|
116
120
|
url?: string;
|
|
@@ -135,23 +139,22 @@ interface IWallet {
|
|
|
135
139
|
messageStr: string;
|
|
136
140
|
}): Promise<SignatureWithBytes>;
|
|
137
141
|
signTransactionBlock(input: {
|
|
138
|
-
transactionBlock:
|
|
142
|
+
transactionBlock: Transaction | Uint8Array;
|
|
139
143
|
}): Promise<SignatureWithBytes>;
|
|
140
144
|
signAndExecuteTransactionBlock(input: {
|
|
141
|
-
transactionBlock:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
145
|
+
transactionBlock: Transaction | Uint8Array;
|
|
146
|
+
include?: SuiClientTypes.TransactionInclude;
|
|
147
|
+
}): Promise<SuiClientTypes.TransactionResult>;
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
declare class MSafeGlobals {
|
|
148
151
|
readonly backend: IBackend;
|
|
149
|
-
readonly suiClient:
|
|
152
|
+
readonly suiClient: SuiGrpcClient;
|
|
150
153
|
readonly config: MSafeConfig;
|
|
151
154
|
_wallet: IWallet | undefined;
|
|
152
155
|
constructor(input: {
|
|
153
156
|
backend: IBackend;
|
|
154
|
-
suiClient:
|
|
157
|
+
suiClient: SuiGrpcClient;
|
|
155
158
|
config: MSafeConfig;
|
|
156
159
|
});
|
|
157
160
|
static New(env: MSafeEnv, options?: MSafeConfigOptions): Promise<MSafeGlobals>;
|
|
@@ -176,6 +179,15 @@ declare class PublicKeyHelper {
|
|
|
176
179
|
private getPublicKeyFromChain;
|
|
177
180
|
}
|
|
178
181
|
|
|
182
|
+
/** Gas coin reference derived from simulation / execution effects. */
|
|
183
|
+
interface GasObjectReference {
|
|
184
|
+
objectId: string;
|
|
185
|
+
version: string;
|
|
186
|
+
digest: string;
|
|
187
|
+
}
|
|
188
|
+
type SimulateDryRunResponse = SuiClientTypes.SimulateTransactionResult<{
|
|
189
|
+
effects: true;
|
|
190
|
+
}>;
|
|
179
191
|
interface PendingTx {
|
|
180
192
|
application: string;
|
|
181
193
|
txType: TransactionType;
|
|
@@ -243,21 +255,21 @@ interface ProposeIntention {
|
|
|
243
255
|
sequenceNumber: number;
|
|
244
256
|
userAddress: string;
|
|
245
257
|
msafeAddress: string;
|
|
246
|
-
signature:
|
|
258
|
+
signature: string;
|
|
247
259
|
}
|
|
248
260
|
type SimulationResult = SimulationSuccessResult | SimulationFailedResult;
|
|
249
261
|
interface SimulationSuccessResult {
|
|
250
262
|
success: true;
|
|
251
263
|
gasPrice: bigint;
|
|
252
|
-
gasUsed: GasCostSummary;
|
|
264
|
+
gasUsed: SuiClientTypes.GasCostSummary;
|
|
253
265
|
gasBudget: bigint;
|
|
254
|
-
gasObject:
|
|
255
|
-
response:
|
|
266
|
+
gasObject: GasObjectReference;
|
|
267
|
+
response: SimulateDryRunResponse;
|
|
256
268
|
}
|
|
257
269
|
interface SimulationFailedResult {
|
|
258
270
|
success: false;
|
|
259
271
|
gasPrice: bigint;
|
|
260
|
-
response
|
|
272
|
+
response?: SimulateDryRunResponse;
|
|
261
273
|
simulationError: string;
|
|
262
274
|
}
|
|
263
275
|
interface SimulationOption extends IGasOption {
|
|
@@ -320,25 +332,31 @@ declare class Simulator {
|
|
|
320
332
|
private globals;
|
|
321
333
|
constructor(globals: MSafeGlobals);
|
|
322
334
|
simulate(input: {
|
|
323
|
-
txb:
|
|
335
|
+
txb: Transaction;
|
|
324
336
|
sender: string;
|
|
325
337
|
}): Promise<SimulationResult>;
|
|
326
338
|
private getGasPrice;
|
|
327
339
|
private toGasBudget;
|
|
328
|
-
private
|
|
340
|
+
private copyTransaction;
|
|
329
341
|
}
|
|
330
342
|
|
|
343
|
+
type CoinMetadata = SuiClientTypes.CoinMetadata;
|
|
331
344
|
interface OwnedCoin {
|
|
332
345
|
type: string;
|
|
333
346
|
balance: bigint;
|
|
334
347
|
metadata?: CoinMetadata;
|
|
335
348
|
}
|
|
336
349
|
|
|
337
|
-
|
|
350
|
+
/** Owned object row with Move JSON content (for helpers like Coin.getBalance). */
|
|
351
|
+
type OwnedObjectData = SuiClientTypes.Object<{
|
|
352
|
+
json: true;
|
|
353
|
+
}>;
|
|
354
|
+
type ObjectFilter = (obj: OwnedObjectData) => boolean;
|
|
338
355
|
interface BatchObjectOptions {
|
|
339
356
|
filter?: ObjectFilter;
|
|
340
357
|
pageSize?: number;
|
|
341
|
-
|
|
358
|
+
/** Extra fields to request from the node; defaults include Move JSON for struct fields. */
|
|
359
|
+
objectInclude?: SuiClientTypes.ObjectInclude;
|
|
342
360
|
}
|
|
343
361
|
|
|
344
362
|
declare class MSafeAccount {
|
|
@@ -350,18 +368,18 @@ declare class MSafeAccount {
|
|
|
350
368
|
constructor(globals: MSafeGlobals, info: IMSafeConfig);
|
|
351
369
|
static New(globals: MSafeGlobals, address: string): Promise<void>;
|
|
352
370
|
ownedCoins(): Promise<OwnedCoin[]>;
|
|
353
|
-
ownedObjects(options?: BatchObjectOptions): Promise<
|
|
371
|
+
ownedObjects(options?: BatchObjectOptions): Promise<OwnedObjectData[]>;
|
|
354
372
|
pendingTransaction(): Promise<PendingTx | undefined>;
|
|
355
373
|
historyTransaction(pagination?: Pagination): Promise<_msafe_sui3_utils.GetHistoryTransactionsResponse>;
|
|
356
374
|
futureIntentions(pagination?: Pagination): Promise<_msafe_sui3_utils.GetTransactionIntentionsResponse>;
|
|
357
375
|
currentSequenceNumber(): Promise<number>;
|
|
358
376
|
nextSequenceNumber(): Promise<number>;
|
|
359
377
|
simulateIntention(request: Omit<IProposeIntentionRequest, 'msafeAddress' | 'signature'> & {
|
|
360
|
-
txb?:
|
|
378
|
+
txb?: Transaction;
|
|
361
379
|
}): Promise<SimulationResult>;
|
|
362
380
|
proposeIntention(input: Omit<IProposeIntentionRequest, 'signature' | 'msafeAddress'>): Promise<void>;
|
|
363
381
|
proposeIntentionAndBuildVote(input: Omit<IProposeIntentionAndBuildAndVoteRequest, 'signature' | 'msafeAddress' | 'payload' | 'digest'> & {
|
|
364
|
-
txb?:
|
|
382
|
+
txb?: Transaction;
|
|
365
383
|
}): Promise<void>;
|
|
366
384
|
simulateCoinTransferIntention(intention: CoinTransferIntention): Promise<SimulationResult>;
|
|
367
385
|
proposeCoinTransferIntention(intention: CoinTransferIntention): Promise<void>;
|
|
@@ -380,7 +398,10 @@ declare class MSafeAccount {
|
|
|
380
398
|
}): Promise<void>;
|
|
381
399
|
skipNextFailedIntention(): Promise<void>;
|
|
382
400
|
fetchTransaction(): Promise<string[]>;
|
|
383
|
-
executePendingTx(pending: PendingTx, isRejectTx?: boolean): Promise<
|
|
401
|
+
executePendingTx(pending: PendingTx, isRejectTx?: boolean): Promise<_mysten_sui_client.SuiClientTypes.TransactionResult<{
|
|
402
|
+
effects: true;
|
|
403
|
+
events: true;
|
|
404
|
+
}>>;
|
|
384
405
|
dashboard(): Promise<_msafe_sui3_utils.IGetDashboardResp>;
|
|
385
406
|
private calculateWeightFromVotes;
|
|
386
407
|
private calculateWeight;
|
|
@@ -432,26 +453,26 @@ declare class SignatureVerifier {
|
|
|
432
453
|
static getPublicKeyFromSignature(input: {
|
|
433
454
|
message: Uint8Array;
|
|
434
455
|
messageType: 'TransactionBlock' | 'Personal';
|
|
435
|
-
signature:
|
|
436
|
-
}): Promise<
|
|
456
|
+
signature: string;
|
|
457
|
+
}): Promise<_mysten_sui_cryptography.PublicKey>;
|
|
437
458
|
static getPublicKeyFromPersonalSignature(input: {
|
|
438
459
|
messageStr: string;
|
|
439
|
-
signature:
|
|
440
|
-
}): Promise<
|
|
460
|
+
signature: string;
|
|
461
|
+
}): Promise<_mysten_sui_cryptography.PublicKey>;
|
|
441
462
|
static verifySignature(input: {
|
|
442
463
|
message: Uint8Array;
|
|
443
464
|
messageType: 'TransactionBlock' | 'Personal';
|
|
444
|
-
signature:
|
|
465
|
+
signature: string;
|
|
445
466
|
targetAddress: string;
|
|
446
467
|
}): Promise<boolean>;
|
|
447
468
|
static verifyPersonalSignature(input: {
|
|
448
469
|
messageStr: string;
|
|
449
|
-
signature:
|
|
470
|
+
signature: string;
|
|
450
471
|
targetAddress: string;
|
|
451
472
|
}): Promise<boolean>;
|
|
452
473
|
static verifyTransactionSignature(input: {
|
|
453
474
|
payload: Uint8Array;
|
|
454
|
-
signature:
|
|
475
|
+
signature: string;
|
|
455
476
|
targetAddress: string;
|
|
456
477
|
}): Promise<boolean>;
|
|
457
478
|
}
|
|
@@ -466,17 +487,17 @@ declare class Formatter {
|
|
|
466
487
|
declare function addPrefix(s: string, prefix: string): string;
|
|
467
488
|
|
|
468
489
|
declare const SUI_COIN = "0x2::sui::SUI";
|
|
469
|
-
declare function getPublicKeyFromChain(suiClient:
|
|
490
|
+
declare function getPublicKeyFromChain(suiClient: SuiGrpcClient, address: string): Promise<PublicKey | undefined>;
|
|
470
491
|
declare function getAllCoins(input: {
|
|
471
|
-
suiClient:
|
|
492
|
+
suiClient: SuiGrpcClient;
|
|
472
493
|
owner: string;
|
|
473
494
|
coinType: string | undefined;
|
|
474
|
-
}): Promise<
|
|
495
|
+
}): Promise<SuiClientTypes.Coin[]>;
|
|
475
496
|
|
|
476
497
|
declare class CoinHelper {
|
|
477
498
|
private _client;
|
|
478
499
|
private _coinMetaReg;
|
|
479
|
-
constructor(client:
|
|
500
|
+
constructor(client: SuiGrpcClient);
|
|
480
501
|
getCoinMeta(coinType: string): Promise<CoinMetadata | undefined>;
|
|
481
502
|
private queryCoinMeta;
|
|
482
503
|
}
|
|
@@ -484,7 +505,21 @@ declare const COIN_TYPE_ARG_REGEX: RegExp;
|
|
|
484
505
|
declare class Coin {
|
|
485
506
|
static isCoin(type: string | undefined | null): boolean;
|
|
486
507
|
static getCoinType(type: string): string | null;
|
|
487
|
-
static getBalance(data:
|
|
508
|
+
static getBalance(data: {
|
|
509
|
+
type?: string | null;
|
|
510
|
+
json?: Record<string, unknown> | null;
|
|
511
|
+
content?: {
|
|
512
|
+
dataType?: string;
|
|
513
|
+
fields?: {
|
|
514
|
+
balance?: string;
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
}): bigint | undefined;
|
|
488
518
|
}
|
|
489
519
|
|
|
490
|
-
|
|
520
|
+
/**
|
|
521
|
+
* Normalize a transaction value to {@link Transaction} (handles plain Transaction or serialized legacy shapes).
|
|
522
|
+
*/
|
|
523
|
+
declare function toSuiTransaction(txb: Transaction | unknown): Transaction;
|
|
524
|
+
|
|
525
|
+
export { AddressBookSDK, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeInfo, DEV_API_URL, DEV_SYNCING_URL, ENV_CONFIGS, Formatter, type FutureIntention, type GasObjectReference, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, InfoTypeEnabledDto, InfoTypeKey, LOCAL_API_URL, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnabledDto, MSafeEnv, MSafeGlobals, type NotificationData, type NotificationInfo, NotificationSubscribeDto, NotificationUpdateDto, PREV_API_URL, PROD_API_URL, type Pagination, type PendingTx, type PendingVote, type ProposeIntention, type ReceiveTransaction, SUI_COIN, SignatureVerifier, type SimulateDryRunResponse, type SimulationFailedResult, type SimulationOption, type SimulationResult, type SimulationSuccessResult, TESTNET_RPC_URL, Uint8ArrayToHex, addPrefix, getAllCoins, getMSafeConfig, getPublicKeyFromChain, httpUrlToGrpcBaseUrl, msafeChainToSuiNetwork, stringToBuffer, toSuiTransaction };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as _msafe_sui3_utils from '@msafe/sui3-utils';
|
|
2
2
|
import { IAuthLoginReq, JWTToken, IMSafeConfig, IUserInfoResp, UserMSafeStatus, IPageOptions, IPagedResult, IGetPendingTransactionRequest, GetPendingTransactionResponse, IGetHistoryTransactionsRequest, GetHistoryTransactionsResponse, IGetIntentionsRequest, GetTransactionIntentionsResponse, IMSafeAddressRequest, TransactionIntentionItem, ICreateMSafeReq, IProposeIntentionRequest, IRejectTransactionRequest, IVoteTransactionRequest, IBuildTransactionRequest, ISkipIntentionRequest, IProposeIntentionAndBuildAndVoteRequest, IGetAddressBookResult, UpdateAddressBookEntry, IGetAddressBookModeResult, ISetAddressBookModeReq, Report, IGetDashboardReq, IGetDashboardResp, TransactionType, TxIntention, IGasOption, PublicKeyWithSchema, AddressBookMode, MultiSigAccount, CoinTransferIntention, ObjectTransferIntention, PlainPayloadIntention } from '@msafe/sui3-utils';
|
|
3
|
-
import * as
|
|
4
|
-
import { PublicKey,
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
3
|
+
import * as _mysten_sui_cryptography from '@mysten/sui/cryptography';
|
|
4
|
+
import { PublicKey, SignatureWithBytes } from '@mysten/sui/cryptography';
|
|
5
|
+
import { RpcTransport, SuiGrpcClient } from '@mysten/sui/grpc';
|
|
6
|
+
import * as _mysten_sui_client from '@mysten/sui/client';
|
|
7
|
+
import { SuiClientTypes } from '@mysten/sui/client';
|
|
8
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
8
9
|
import { Buffer } from 'buffer';
|
|
9
10
|
|
|
10
11
|
declare enum InfoTypeKey {
|
|
@@ -78,7 +79,7 @@ interface IBackend {
|
|
|
78
79
|
getAddressBookEntries(pagination?: IPageOptions): Promise<IGetAddressBookResult>;
|
|
79
80
|
updateAddressBook(input: {
|
|
80
81
|
updates: UpdateAddressBookEntry[];
|
|
81
|
-
signature:
|
|
82
|
+
signature: string;
|
|
82
83
|
}): Promise<void>;
|
|
83
84
|
getAddressBookMode(): Promise<IGetAddressBookModeResult>;
|
|
84
85
|
setAddressBookMode(input: ISetAddressBookModeReq): Promise<void>;
|
|
@@ -89,6 +90,7 @@ interface IBackend {
|
|
|
89
90
|
updateNotificationSubscription(input: NotificationUpdateDto): Promise<void>;
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
declare function msafeChainToSuiNetwork(chain: 'sui:mainnet' | 'sui:testnet'): 'mainnet' | 'testnet';
|
|
92
94
|
declare enum MSafeEnv {
|
|
93
95
|
local = "local",
|
|
94
96
|
unit = "unit",
|
|
@@ -96,10 +98,12 @@ declare enum MSafeEnv {
|
|
|
96
98
|
prev = "prev",
|
|
97
99
|
prod = "prod"
|
|
98
100
|
}
|
|
101
|
+
/** Normalize HTTP(S) fullnode URL for SuiGrpcClient (gRPC-web) baseUrl. */
|
|
102
|
+
declare function httpUrlToGrpcBaseUrl(url: string): string;
|
|
99
103
|
interface MSafeConfig {
|
|
100
104
|
suiClient: {
|
|
101
105
|
url: string;
|
|
102
|
-
transport?:
|
|
106
|
+
transport?: RpcTransport;
|
|
103
107
|
};
|
|
104
108
|
backend: {
|
|
105
109
|
url: string;
|
|
@@ -110,7 +114,7 @@ interface MSafeConfig {
|
|
|
110
114
|
interface MSafeConfigOptions {
|
|
111
115
|
suiClient?: {
|
|
112
116
|
url: string;
|
|
113
|
-
transport?:
|
|
117
|
+
transport?: RpcTransport;
|
|
114
118
|
};
|
|
115
119
|
backend?: {
|
|
116
120
|
url?: string;
|
|
@@ -135,23 +139,22 @@ interface IWallet {
|
|
|
135
139
|
messageStr: string;
|
|
136
140
|
}): Promise<SignatureWithBytes>;
|
|
137
141
|
signTransactionBlock(input: {
|
|
138
|
-
transactionBlock:
|
|
142
|
+
transactionBlock: Transaction | Uint8Array;
|
|
139
143
|
}): Promise<SignatureWithBytes>;
|
|
140
144
|
signAndExecuteTransactionBlock(input: {
|
|
141
|
-
transactionBlock:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
145
|
+
transactionBlock: Transaction | Uint8Array;
|
|
146
|
+
include?: SuiClientTypes.TransactionInclude;
|
|
147
|
+
}): Promise<SuiClientTypes.TransactionResult>;
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
declare class MSafeGlobals {
|
|
148
151
|
readonly backend: IBackend;
|
|
149
|
-
readonly suiClient:
|
|
152
|
+
readonly suiClient: SuiGrpcClient;
|
|
150
153
|
readonly config: MSafeConfig;
|
|
151
154
|
_wallet: IWallet | undefined;
|
|
152
155
|
constructor(input: {
|
|
153
156
|
backend: IBackend;
|
|
154
|
-
suiClient:
|
|
157
|
+
suiClient: SuiGrpcClient;
|
|
155
158
|
config: MSafeConfig;
|
|
156
159
|
});
|
|
157
160
|
static New(env: MSafeEnv, options?: MSafeConfigOptions): Promise<MSafeGlobals>;
|
|
@@ -176,6 +179,15 @@ declare class PublicKeyHelper {
|
|
|
176
179
|
private getPublicKeyFromChain;
|
|
177
180
|
}
|
|
178
181
|
|
|
182
|
+
/** Gas coin reference derived from simulation / execution effects. */
|
|
183
|
+
interface GasObjectReference {
|
|
184
|
+
objectId: string;
|
|
185
|
+
version: string;
|
|
186
|
+
digest: string;
|
|
187
|
+
}
|
|
188
|
+
type SimulateDryRunResponse = SuiClientTypes.SimulateTransactionResult<{
|
|
189
|
+
effects: true;
|
|
190
|
+
}>;
|
|
179
191
|
interface PendingTx {
|
|
180
192
|
application: string;
|
|
181
193
|
txType: TransactionType;
|
|
@@ -243,21 +255,21 @@ interface ProposeIntention {
|
|
|
243
255
|
sequenceNumber: number;
|
|
244
256
|
userAddress: string;
|
|
245
257
|
msafeAddress: string;
|
|
246
|
-
signature:
|
|
258
|
+
signature: string;
|
|
247
259
|
}
|
|
248
260
|
type SimulationResult = SimulationSuccessResult | SimulationFailedResult;
|
|
249
261
|
interface SimulationSuccessResult {
|
|
250
262
|
success: true;
|
|
251
263
|
gasPrice: bigint;
|
|
252
|
-
gasUsed: GasCostSummary;
|
|
264
|
+
gasUsed: SuiClientTypes.GasCostSummary;
|
|
253
265
|
gasBudget: bigint;
|
|
254
|
-
gasObject:
|
|
255
|
-
response:
|
|
266
|
+
gasObject: GasObjectReference;
|
|
267
|
+
response: SimulateDryRunResponse;
|
|
256
268
|
}
|
|
257
269
|
interface SimulationFailedResult {
|
|
258
270
|
success: false;
|
|
259
271
|
gasPrice: bigint;
|
|
260
|
-
response
|
|
272
|
+
response?: SimulateDryRunResponse;
|
|
261
273
|
simulationError: string;
|
|
262
274
|
}
|
|
263
275
|
interface SimulationOption extends IGasOption {
|
|
@@ -320,25 +332,31 @@ declare class Simulator {
|
|
|
320
332
|
private globals;
|
|
321
333
|
constructor(globals: MSafeGlobals);
|
|
322
334
|
simulate(input: {
|
|
323
|
-
txb:
|
|
335
|
+
txb: Transaction;
|
|
324
336
|
sender: string;
|
|
325
337
|
}): Promise<SimulationResult>;
|
|
326
338
|
private getGasPrice;
|
|
327
339
|
private toGasBudget;
|
|
328
|
-
private
|
|
340
|
+
private copyTransaction;
|
|
329
341
|
}
|
|
330
342
|
|
|
343
|
+
type CoinMetadata = SuiClientTypes.CoinMetadata;
|
|
331
344
|
interface OwnedCoin {
|
|
332
345
|
type: string;
|
|
333
346
|
balance: bigint;
|
|
334
347
|
metadata?: CoinMetadata;
|
|
335
348
|
}
|
|
336
349
|
|
|
337
|
-
|
|
350
|
+
/** Owned object row with Move JSON content (for helpers like Coin.getBalance). */
|
|
351
|
+
type OwnedObjectData = SuiClientTypes.Object<{
|
|
352
|
+
json: true;
|
|
353
|
+
}>;
|
|
354
|
+
type ObjectFilter = (obj: OwnedObjectData) => boolean;
|
|
338
355
|
interface BatchObjectOptions {
|
|
339
356
|
filter?: ObjectFilter;
|
|
340
357
|
pageSize?: number;
|
|
341
|
-
|
|
358
|
+
/** Extra fields to request from the node; defaults include Move JSON for struct fields. */
|
|
359
|
+
objectInclude?: SuiClientTypes.ObjectInclude;
|
|
342
360
|
}
|
|
343
361
|
|
|
344
362
|
declare class MSafeAccount {
|
|
@@ -350,18 +368,18 @@ declare class MSafeAccount {
|
|
|
350
368
|
constructor(globals: MSafeGlobals, info: IMSafeConfig);
|
|
351
369
|
static New(globals: MSafeGlobals, address: string): Promise<void>;
|
|
352
370
|
ownedCoins(): Promise<OwnedCoin[]>;
|
|
353
|
-
ownedObjects(options?: BatchObjectOptions): Promise<
|
|
371
|
+
ownedObjects(options?: BatchObjectOptions): Promise<OwnedObjectData[]>;
|
|
354
372
|
pendingTransaction(): Promise<PendingTx | undefined>;
|
|
355
373
|
historyTransaction(pagination?: Pagination): Promise<_msafe_sui3_utils.GetHistoryTransactionsResponse>;
|
|
356
374
|
futureIntentions(pagination?: Pagination): Promise<_msafe_sui3_utils.GetTransactionIntentionsResponse>;
|
|
357
375
|
currentSequenceNumber(): Promise<number>;
|
|
358
376
|
nextSequenceNumber(): Promise<number>;
|
|
359
377
|
simulateIntention(request: Omit<IProposeIntentionRequest, 'msafeAddress' | 'signature'> & {
|
|
360
|
-
txb?:
|
|
378
|
+
txb?: Transaction;
|
|
361
379
|
}): Promise<SimulationResult>;
|
|
362
380
|
proposeIntention(input: Omit<IProposeIntentionRequest, 'signature' | 'msafeAddress'>): Promise<void>;
|
|
363
381
|
proposeIntentionAndBuildVote(input: Omit<IProposeIntentionAndBuildAndVoteRequest, 'signature' | 'msafeAddress' | 'payload' | 'digest'> & {
|
|
364
|
-
txb?:
|
|
382
|
+
txb?: Transaction;
|
|
365
383
|
}): Promise<void>;
|
|
366
384
|
simulateCoinTransferIntention(intention: CoinTransferIntention): Promise<SimulationResult>;
|
|
367
385
|
proposeCoinTransferIntention(intention: CoinTransferIntention): Promise<void>;
|
|
@@ -380,7 +398,10 @@ declare class MSafeAccount {
|
|
|
380
398
|
}): Promise<void>;
|
|
381
399
|
skipNextFailedIntention(): Promise<void>;
|
|
382
400
|
fetchTransaction(): Promise<string[]>;
|
|
383
|
-
executePendingTx(pending: PendingTx, isRejectTx?: boolean): Promise<
|
|
401
|
+
executePendingTx(pending: PendingTx, isRejectTx?: boolean): Promise<_mysten_sui_client.SuiClientTypes.TransactionResult<{
|
|
402
|
+
effects: true;
|
|
403
|
+
events: true;
|
|
404
|
+
}>>;
|
|
384
405
|
dashboard(): Promise<_msafe_sui3_utils.IGetDashboardResp>;
|
|
385
406
|
private calculateWeightFromVotes;
|
|
386
407
|
private calculateWeight;
|
|
@@ -432,26 +453,26 @@ declare class SignatureVerifier {
|
|
|
432
453
|
static getPublicKeyFromSignature(input: {
|
|
433
454
|
message: Uint8Array;
|
|
434
455
|
messageType: 'TransactionBlock' | 'Personal';
|
|
435
|
-
signature:
|
|
436
|
-
}): Promise<
|
|
456
|
+
signature: string;
|
|
457
|
+
}): Promise<_mysten_sui_cryptography.PublicKey>;
|
|
437
458
|
static getPublicKeyFromPersonalSignature(input: {
|
|
438
459
|
messageStr: string;
|
|
439
|
-
signature:
|
|
440
|
-
}): Promise<
|
|
460
|
+
signature: string;
|
|
461
|
+
}): Promise<_mysten_sui_cryptography.PublicKey>;
|
|
441
462
|
static verifySignature(input: {
|
|
442
463
|
message: Uint8Array;
|
|
443
464
|
messageType: 'TransactionBlock' | 'Personal';
|
|
444
|
-
signature:
|
|
465
|
+
signature: string;
|
|
445
466
|
targetAddress: string;
|
|
446
467
|
}): Promise<boolean>;
|
|
447
468
|
static verifyPersonalSignature(input: {
|
|
448
469
|
messageStr: string;
|
|
449
|
-
signature:
|
|
470
|
+
signature: string;
|
|
450
471
|
targetAddress: string;
|
|
451
472
|
}): Promise<boolean>;
|
|
452
473
|
static verifyTransactionSignature(input: {
|
|
453
474
|
payload: Uint8Array;
|
|
454
|
-
signature:
|
|
475
|
+
signature: string;
|
|
455
476
|
targetAddress: string;
|
|
456
477
|
}): Promise<boolean>;
|
|
457
478
|
}
|
|
@@ -466,17 +487,17 @@ declare class Formatter {
|
|
|
466
487
|
declare function addPrefix(s: string, prefix: string): string;
|
|
467
488
|
|
|
468
489
|
declare const SUI_COIN = "0x2::sui::SUI";
|
|
469
|
-
declare function getPublicKeyFromChain(suiClient:
|
|
490
|
+
declare function getPublicKeyFromChain(suiClient: SuiGrpcClient, address: string): Promise<PublicKey | undefined>;
|
|
470
491
|
declare function getAllCoins(input: {
|
|
471
|
-
suiClient:
|
|
492
|
+
suiClient: SuiGrpcClient;
|
|
472
493
|
owner: string;
|
|
473
494
|
coinType: string | undefined;
|
|
474
|
-
}): Promise<
|
|
495
|
+
}): Promise<SuiClientTypes.Coin[]>;
|
|
475
496
|
|
|
476
497
|
declare class CoinHelper {
|
|
477
498
|
private _client;
|
|
478
499
|
private _coinMetaReg;
|
|
479
|
-
constructor(client:
|
|
500
|
+
constructor(client: SuiGrpcClient);
|
|
480
501
|
getCoinMeta(coinType: string): Promise<CoinMetadata | undefined>;
|
|
481
502
|
private queryCoinMeta;
|
|
482
503
|
}
|
|
@@ -484,7 +505,21 @@ declare const COIN_TYPE_ARG_REGEX: RegExp;
|
|
|
484
505
|
declare class Coin {
|
|
485
506
|
static isCoin(type: string | undefined | null): boolean;
|
|
486
507
|
static getCoinType(type: string): string | null;
|
|
487
|
-
static getBalance(data:
|
|
508
|
+
static getBalance(data: {
|
|
509
|
+
type?: string | null;
|
|
510
|
+
json?: Record<string, unknown> | null;
|
|
511
|
+
content?: {
|
|
512
|
+
dataType?: string;
|
|
513
|
+
fields?: {
|
|
514
|
+
balance?: string;
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
}): bigint | undefined;
|
|
488
518
|
}
|
|
489
519
|
|
|
490
|
-
|
|
520
|
+
/**
|
|
521
|
+
* Normalize a transaction value to {@link Transaction} (handles plain Transaction or serialized legacy shapes).
|
|
522
|
+
*/
|
|
523
|
+
declare function toSuiTransaction(txb: Transaction | unknown): Transaction;
|
|
524
|
+
|
|
525
|
+
export { AddressBookSDK, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeInfo, DEV_API_URL, DEV_SYNCING_URL, ENV_CONFIGS, Formatter, type FutureIntention, type GasObjectReference, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, InfoTypeEnabledDto, InfoTypeKey, LOCAL_API_URL, LOCAL_SYNCING_URL, MAINNET_RPC_URL, MSafeAccount, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnabledDto, MSafeEnv, MSafeGlobals, type NotificationData, type NotificationInfo, NotificationSubscribeDto, NotificationUpdateDto, PREV_API_URL, PROD_API_URL, type Pagination, type PendingTx, type PendingVote, type ProposeIntention, type ReceiveTransaction, SUI_COIN, SignatureVerifier, type SimulateDryRunResponse, type SimulationFailedResult, type SimulationOption, type SimulationResult, type SimulationSuccessResult, TESTNET_RPC_URL, Uint8ArrayToHex, addPrefix, getAllCoins, getMSafeConfig, getPublicKeyFromChain, httpUrlToGrpcBaseUrl, msafeChainToSuiNetwork, stringToBuffer, toSuiTransaction };
|