@msafe/sui3-sdk 0.0.4-pre-113020e.0 → 0.0.4
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 +969 -258
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -24
- package/dist/index.d.ts +89 -24
- package/dist/index.js +958 -251
- package/dist/index.js.map +1 -1
- package/package.json +3 -6
- package/src/backend/PseudoBackend.ts +14 -25
- package/src/backend/interface.ts +10 -10
- package/src/backend/types.ts +21 -0
- package/src/core/CreateHelper.ts +12 -22
- package/src/core/MSafeAccount.ts +5 -9
- package/src/core/MSafeClient.ts +6 -2
- package/src/globals/MSafeGlobals.ts +1 -2
- package/src/globals/const.ts +1 -8
- package/src/types/msafe.ts +20 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/multi-sig.ts +113 -0
- package/src/backend/BackendImpl.ts +0 -196
package/dist/index.d.cts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as _mysten_sui_js_src_cryptography from '@mysten/sui.js/src/cryptography';
|
|
2
|
-
import { PublicKey
|
|
2
|
+
import { PublicKey } from '@mysten/sui.js/src/cryptography';
|
|
3
3
|
import { SuiClient, ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions, SuiTransactionBlockResponse, CoinStruct, CoinMetadata, SuiObjectData } from '@mysten/sui.js/client';
|
|
4
|
-
import
|
|
5
|
-
import { AuthLoginRequest, MSafeAccountInfo, UserWithOwnedMSafe, CreateMSafeAccountInfoRequest, MultisigAccountManager } from '@msafe/sui3-utils';
|
|
6
|
-
import { PublicKey, SerializedSignature, SignatureScheme } from '@mysten/sui.js/cryptography';
|
|
4
|
+
import { SerializedSignature, PublicKey as PublicKey$1, SignatureScheme } from '@mysten/sui.js/cryptography';
|
|
7
5
|
import * as _mysten_sui_js_dist_cjs_builder from '@mysten/sui.js/dist/cjs/builder';
|
|
8
6
|
import { ModelConfig } from '@msafe/sui3-model/common';
|
|
9
7
|
import { SignatureWithBytes } from '@mysten/sui.js/src/cryptography/keypair';
|
|
10
8
|
import { TransactionBlock } from '@mysten/sui.js/transactions';
|
|
11
9
|
import * as _mysten_sui_js_dist_cjs_client from '@mysten/sui.js/dist/cjs/client';
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
import { Ed25519PublicKey } from '@mysten/sui.js/keypairs/ed25519';
|
|
11
|
+
import { MultiSigPublicKey } from '@mysten/sui.js/multisig';
|
|
14
12
|
|
|
15
13
|
interface IntentionCoinTransfer {
|
|
16
14
|
txType: 'CoinTransfer';
|
|
@@ -45,6 +43,21 @@ declare class IntentionHelper {
|
|
|
45
43
|
}): Promise<_mysten_sui_js_dist_cjs_builder.TransactionBlock>;
|
|
46
44
|
}
|
|
47
45
|
|
|
46
|
+
interface MSafeAccountInfo {
|
|
47
|
+
address: string;
|
|
48
|
+
ownersWithWeightPK: OwnerWithWeightPK[];
|
|
49
|
+
threshold: number;
|
|
50
|
+
name: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
creationNonce: number;
|
|
53
|
+
}
|
|
54
|
+
type OwnerWithWeightPK = OwnerWithWeight & {
|
|
55
|
+
publicKey: PublicKey;
|
|
56
|
+
};
|
|
57
|
+
interface OwnerWithWeight {
|
|
58
|
+
address: string;
|
|
59
|
+
weight: number;
|
|
60
|
+
}
|
|
48
61
|
interface PendingTx {
|
|
49
62
|
digest: string;
|
|
50
63
|
payload: string;
|
|
@@ -97,11 +110,34 @@ interface FutureIntention {
|
|
|
97
110
|
createdAt: Date;
|
|
98
111
|
}
|
|
99
112
|
|
|
113
|
+
type JWTToken = string;
|
|
114
|
+
interface CreateMSafeParams {
|
|
115
|
+
ownerWithWeight: OwnerWithWeightPK[];
|
|
116
|
+
threshold: number;
|
|
117
|
+
name: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
creationNonce: number;
|
|
120
|
+
signature: SerializedSignature;
|
|
121
|
+
}
|
|
122
|
+
interface UserWithOwnedMSafe {
|
|
123
|
+
address: string;
|
|
124
|
+
publicKey: string;
|
|
125
|
+
schema: string;
|
|
126
|
+
creationNonce: number;
|
|
127
|
+
ownedMSafe: MSafeAccountInfo[];
|
|
128
|
+
}
|
|
129
|
+
|
|
100
130
|
interface IBackend {
|
|
101
|
-
|
|
131
|
+
isJWTTokenValid(jwt: JWTToken): Promise<boolean>;
|
|
132
|
+
authSign(input: {
|
|
133
|
+
address: string;
|
|
134
|
+
message: string;
|
|
135
|
+
signature: SerializedSignature;
|
|
136
|
+
walletType: string;
|
|
137
|
+
}): Promise<JWTToken>;
|
|
102
138
|
setJWTToken(token: JWTToken): void;
|
|
103
|
-
getPublicKey(address: string): Promise<PublicKey | undefined>;
|
|
104
|
-
getPublicKeyBatch(addresses: string[]): Promise<(PublicKey | undefined)[]>;
|
|
139
|
+
getPublicKey(address: string): Promise<PublicKey$1 | undefined>;
|
|
140
|
+
getPublicKeyBatch(addresses: string[]): Promise<(PublicKey$1 | undefined)[]>;
|
|
105
141
|
getMSafeAccountInfo(msafeAddress: string): Promise<MSafeAccountInfo>;
|
|
106
142
|
getUserInfo(userAddress: string): Promise<UserWithOwnedMSafe>;
|
|
107
143
|
getPendingTransactions(msafeAddress: string): Promise<PendingTx[]>;
|
|
@@ -109,7 +145,7 @@ interface IBackend {
|
|
|
109
145
|
getFutureIntentions(msafeAddress: string): Promise<FutureIntention[]>;
|
|
110
146
|
getCurrentSequenceNumber(msafeAddress: string): Promise<number>;
|
|
111
147
|
getNextSequenceNumber(msafeAddress: string): Promise<number>;
|
|
112
|
-
createMSafeAccount(input:
|
|
148
|
+
createMSafeAccount(input: CreateMSafeParams): Promise<void>;
|
|
113
149
|
proposeIntention(input: {
|
|
114
150
|
intention: TxIntention;
|
|
115
151
|
sequenceNumber: number;
|
|
@@ -158,7 +194,6 @@ interface MSafeConfig {
|
|
|
158
194
|
url: string;
|
|
159
195
|
};
|
|
160
196
|
backend: DBConfig;
|
|
161
|
-
apiURL: string;
|
|
162
197
|
}
|
|
163
198
|
interface MSafeConfigOptions {
|
|
164
199
|
suiClient?: {
|
|
@@ -172,8 +207,6 @@ declare const LOCAL_DATABASE_CONFIG: DBConfig;
|
|
|
172
207
|
declare const DEV_DATABASE_CONFIG: DBConfig;
|
|
173
208
|
declare const TESTNET_RPC_URL = "https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD";
|
|
174
209
|
declare const MAINNET_RPC_URL = "https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7";
|
|
175
|
-
declare const LOCAL_API_URL = "http://127.0.0.1:3000";
|
|
176
|
-
declare const DEV_API_URL = "http://13.56.226.148";
|
|
177
210
|
declare const ENV_CONFIGS: Map<MSafeEnv, MSafeConfig>;
|
|
178
211
|
declare function getMSafeConfig(env: MSafeEnv, options?: MSafeConfigOptions): MSafeConfig;
|
|
179
212
|
declare const AUTH_SIGN_MESSAGE = "Welcome to MSafe";
|
|
@@ -218,8 +251,8 @@ declare class PublicKeyHelper {
|
|
|
218
251
|
readonly globals: MSafeGlobals;
|
|
219
252
|
private knownPublicKeys;
|
|
220
253
|
constructor(globals: MSafeGlobals);
|
|
221
|
-
getPublicKey(address: string): Promise<PublicKey
|
|
222
|
-
getPublicKeyBatch(addresses: string[]): Promise<(PublicKey
|
|
254
|
+
getPublicKey(address: string): Promise<PublicKey | undefined>;
|
|
255
|
+
getPublicKeyBatch(addresses: string[]): Promise<(PublicKey | undefined)[]>;
|
|
223
256
|
private _getPublicKey;
|
|
224
257
|
private getPublicKeyFromBackend;
|
|
225
258
|
private getPublicKeyFromChain;
|
|
@@ -269,10 +302,42 @@ interface ProposeIntentionData {
|
|
|
269
302
|
sn: number;
|
|
270
303
|
}
|
|
271
304
|
|
|
305
|
+
interface PublicKeyWithWeight {
|
|
306
|
+
publicKey: PublicKey$1;
|
|
307
|
+
weight: number;
|
|
308
|
+
}
|
|
309
|
+
interface MultiSigConfig {
|
|
310
|
+
threshold: number;
|
|
311
|
+
ownerWithWeight: PublicKeyWithWeight[];
|
|
312
|
+
creationNonce: number | undefined;
|
|
313
|
+
}
|
|
314
|
+
declare const NONCE_PK_PREFIX = "maven";
|
|
315
|
+
declare const NONCE_PREFIX_MAX_SIZE = 16;
|
|
316
|
+
declare const NONCE_PK_WEIGHT = 1;
|
|
317
|
+
declare const MAX_WEIGHT = 255;
|
|
318
|
+
declare const MIN_WEIGHT = 1;
|
|
319
|
+
declare const MAX_OWNER_WITH_NONCE = 9;
|
|
320
|
+
declare const MAX_OWNER_WITHOUT_NONCE = 10;
|
|
321
|
+
declare const MIN_THRESHOLD = 1;
|
|
322
|
+
declare class RawMultiSig {
|
|
323
|
+
readonly config: MultiSigConfig;
|
|
324
|
+
rawMsPK: MultiSigPublicKey;
|
|
325
|
+
constructor(config: MultiSigConfig);
|
|
326
|
+
static fromMSafeAccountInfo(info: MSafeAccountInfo): RawMultiSig;
|
|
327
|
+
get suiAddress(): string;
|
|
328
|
+
get publicKeys(): PublicKeyWithWeight[];
|
|
329
|
+
get threshold(): number;
|
|
330
|
+
combinePartialSignatures(signatures: SerializedSignature[]): SerializedSignature;
|
|
331
|
+
verifyPersonalMessage(messageStr: string, multiSigSignature: SerializedSignature): Promise<boolean>;
|
|
332
|
+
}
|
|
333
|
+
declare function getMultiSigPublicKey(config: MultiSigConfig): MultiSigPublicKey;
|
|
334
|
+
declare function makeNoncePublicKey(nonce: number): Ed25519PublicKey;
|
|
335
|
+
declare function validateMultiSigConfig(config: MultiSigConfig): void;
|
|
336
|
+
|
|
272
337
|
declare class MSafeAccount {
|
|
273
338
|
readonly globals: MSafeGlobals;
|
|
274
339
|
readonly info: MSafeAccountInfo;
|
|
275
|
-
|
|
340
|
+
rawMultiSig: RawMultiSig;
|
|
276
341
|
constructor(globals: MSafeGlobals, info: MSafeAccountInfo);
|
|
277
342
|
static new(globals: MSafeGlobals, address: string): Promise<MSafeAccount>;
|
|
278
343
|
pendingTransactions(): Promise<PendingTx[]>;
|
|
@@ -304,7 +369,7 @@ declare class MSafeClient {
|
|
|
304
369
|
wallet: IWallet;
|
|
305
370
|
jwtToken?: JWTToken;
|
|
306
371
|
}): Promise<JWTToken>;
|
|
307
|
-
userInfo(): Promise<
|
|
372
|
+
userInfo(): Promise<UserWithOwnedMSafe>;
|
|
308
373
|
createAccount(info: CreateMSafeAccountInfo): Promise<string>;
|
|
309
374
|
getMSafeAccount(info: MSafeAccountInfo): MSafeAccount;
|
|
310
375
|
getMSafeAccountFromAddress(msafeAddress: string): Promise<MSafeAccount>;
|
|
@@ -325,11 +390,11 @@ declare class SignatureVerifier {
|
|
|
325
390
|
message: Uint8Array;
|
|
326
391
|
messageType: 'TransactionBlock' | 'Personal';
|
|
327
392
|
signature: SerializedSignature;
|
|
328
|
-
}): Promise<PublicKey>;
|
|
393
|
+
}): Promise<PublicKey$1>;
|
|
329
394
|
static getPublicKeyFromPersonalSignature(input: {
|
|
330
395
|
messageStr: string;
|
|
331
396
|
signature: SerializedSignature;
|
|
332
|
-
}): Promise<PublicKey>;
|
|
397
|
+
}): Promise<PublicKey$1>;
|
|
333
398
|
static verifySignature(input: {
|
|
334
399
|
message: Uint8Array;
|
|
335
400
|
messageType: 'TransactionBlock' | 'Personal';
|
|
@@ -348,14 +413,14 @@ declare class SignatureVerifier {
|
|
|
348
413
|
}): Promise<boolean>;
|
|
349
414
|
}
|
|
350
415
|
declare class PublicKeySerde {
|
|
351
|
-
static ser(publicKey: PublicKey): {
|
|
416
|
+
static ser(publicKey: PublicKey$1): {
|
|
352
417
|
publicKey: string;
|
|
353
|
-
scheme: "ED25519" | "
|
|
418
|
+
scheme: "ED25519" | "Secp256r1" | "Secp256k1" | "MultiSig" | "ZkLogin";
|
|
354
419
|
};
|
|
355
420
|
static de(input: {
|
|
356
421
|
publicKey: string | Uint8Array;
|
|
357
422
|
scheme: SignatureScheme;
|
|
358
|
-
}): PublicKey;
|
|
423
|
+
}): PublicKey$1;
|
|
359
424
|
}
|
|
360
425
|
|
|
361
426
|
declare class Formatter {
|
|
@@ -367,7 +432,7 @@ declare class Formatter {
|
|
|
367
432
|
}
|
|
368
433
|
|
|
369
434
|
declare const SUI_COIN = "0x2::sui::SUI";
|
|
370
|
-
declare function getPublicKeyFromChain(suiClient: SuiClient, address: string): Promise<PublicKey | undefined>;
|
|
435
|
+
declare function getPublicKeyFromChain(suiClient: SuiClient, address: string): Promise<PublicKey$1 | undefined>;
|
|
371
436
|
declare function getAllCoins(input: {
|
|
372
437
|
suiClient: SuiClient;
|
|
373
438
|
owner: string;
|
|
@@ -388,4 +453,4 @@ declare class Coin {
|
|
|
388
453
|
static getBalance(data: SuiObjectData): bigint | undefined;
|
|
389
454
|
}
|
|
390
455
|
|
|
391
|
-
export { AUTH_SIGN_MESSAGE, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig,
|
|
456
|
+
export { AUTH_SIGN_MESSAGE, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig, DEV_DATABASE_CONFIG, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, IntentionHelper, LOCAL_DATABASE_CONFIG, MAINNET_RPC_URL, MAX_OWNER_WITHOUT_NONCE, MAX_OWNER_WITH_NONCE, MAX_WEIGHT, MIN_THRESHOLD, MIN_WEIGHT, MSafeAccount, type MSafeAccountInfo, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, MessageHelper, type MultiSigConfig, NONCE_PK_PREFIX, NONCE_PK_WEIGHT, NONCE_PREFIX_MAX_SIZE, type OwnerWithWeight, type OwnerWithWeightPK, type PendingTx, type PendingVote, PublicKeySerde, type PublicKeyWithWeight, RawMultiSig, type ReceiveTransaction, SUI_COIN, SignatureVerifier, TESTNET_RPC_URL, type TxIntention, UNIT_DATABASE_CONFIG, Uint8ArrayToHex, getAllCoins, getMSafeConfig, getMultiSigPublicKey, getPublicKeyFromChain, makeNoncePublicKey, stringToBuffer, validateMultiSigConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as _mysten_sui_js_src_cryptography from '@mysten/sui.js/src/cryptography';
|
|
2
|
-
import { PublicKey
|
|
2
|
+
import { PublicKey } from '@mysten/sui.js/src/cryptography';
|
|
3
3
|
import { SuiClient, ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions, SuiTransactionBlockResponse, CoinStruct, CoinMetadata, SuiObjectData } from '@mysten/sui.js/client';
|
|
4
|
-
import
|
|
5
|
-
import { AuthLoginRequest, MSafeAccountInfo, UserWithOwnedMSafe, CreateMSafeAccountInfoRequest, MultisigAccountManager } from '@msafe/sui3-utils';
|
|
6
|
-
import { PublicKey, SerializedSignature, SignatureScheme } from '@mysten/sui.js/cryptography';
|
|
4
|
+
import { SerializedSignature, PublicKey as PublicKey$1, SignatureScheme } from '@mysten/sui.js/cryptography';
|
|
7
5
|
import * as _mysten_sui_js_dist_cjs_builder from '@mysten/sui.js/dist/cjs/builder';
|
|
8
6
|
import { ModelConfig } from '@msafe/sui3-model/common';
|
|
9
7
|
import { SignatureWithBytes } from '@mysten/sui.js/src/cryptography/keypair';
|
|
10
8
|
import { TransactionBlock } from '@mysten/sui.js/transactions';
|
|
11
9
|
import * as _mysten_sui_js_dist_cjs_client from '@mysten/sui.js/dist/cjs/client';
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
import { Ed25519PublicKey } from '@mysten/sui.js/keypairs/ed25519';
|
|
11
|
+
import { MultiSigPublicKey } from '@mysten/sui.js/multisig';
|
|
14
12
|
|
|
15
13
|
interface IntentionCoinTransfer {
|
|
16
14
|
txType: 'CoinTransfer';
|
|
@@ -45,6 +43,21 @@ declare class IntentionHelper {
|
|
|
45
43
|
}): Promise<_mysten_sui_js_dist_cjs_builder.TransactionBlock>;
|
|
46
44
|
}
|
|
47
45
|
|
|
46
|
+
interface MSafeAccountInfo {
|
|
47
|
+
address: string;
|
|
48
|
+
ownersWithWeightPK: OwnerWithWeightPK[];
|
|
49
|
+
threshold: number;
|
|
50
|
+
name: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
creationNonce: number;
|
|
53
|
+
}
|
|
54
|
+
type OwnerWithWeightPK = OwnerWithWeight & {
|
|
55
|
+
publicKey: PublicKey;
|
|
56
|
+
};
|
|
57
|
+
interface OwnerWithWeight {
|
|
58
|
+
address: string;
|
|
59
|
+
weight: number;
|
|
60
|
+
}
|
|
48
61
|
interface PendingTx {
|
|
49
62
|
digest: string;
|
|
50
63
|
payload: string;
|
|
@@ -97,11 +110,34 @@ interface FutureIntention {
|
|
|
97
110
|
createdAt: Date;
|
|
98
111
|
}
|
|
99
112
|
|
|
113
|
+
type JWTToken = string;
|
|
114
|
+
interface CreateMSafeParams {
|
|
115
|
+
ownerWithWeight: OwnerWithWeightPK[];
|
|
116
|
+
threshold: number;
|
|
117
|
+
name: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
creationNonce: number;
|
|
120
|
+
signature: SerializedSignature;
|
|
121
|
+
}
|
|
122
|
+
interface UserWithOwnedMSafe {
|
|
123
|
+
address: string;
|
|
124
|
+
publicKey: string;
|
|
125
|
+
schema: string;
|
|
126
|
+
creationNonce: number;
|
|
127
|
+
ownedMSafe: MSafeAccountInfo[];
|
|
128
|
+
}
|
|
129
|
+
|
|
100
130
|
interface IBackend {
|
|
101
|
-
|
|
131
|
+
isJWTTokenValid(jwt: JWTToken): Promise<boolean>;
|
|
132
|
+
authSign(input: {
|
|
133
|
+
address: string;
|
|
134
|
+
message: string;
|
|
135
|
+
signature: SerializedSignature;
|
|
136
|
+
walletType: string;
|
|
137
|
+
}): Promise<JWTToken>;
|
|
102
138
|
setJWTToken(token: JWTToken): void;
|
|
103
|
-
getPublicKey(address: string): Promise<PublicKey | undefined>;
|
|
104
|
-
getPublicKeyBatch(addresses: string[]): Promise<(PublicKey | undefined)[]>;
|
|
139
|
+
getPublicKey(address: string): Promise<PublicKey$1 | undefined>;
|
|
140
|
+
getPublicKeyBatch(addresses: string[]): Promise<(PublicKey$1 | undefined)[]>;
|
|
105
141
|
getMSafeAccountInfo(msafeAddress: string): Promise<MSafeAccountInfo>;
|
|
106
142
|
getUserInfo(userAddress: string): Promise<UserWithOwnedMSafe>;
|
|
107
143
|
getPendingTransactions(msafeAddress: string): Promise<PendingTx[]>;
|
|
@@ -109,7 +145,7 @@ interface IBackend {
|
|
|
109
145
|
getFutureIntentions(msafeAddress: string): Promise<FutureIntention[]>;
|
|
110
146
|
getCurrentSequenceNumber(msafeAddress: string): Promise<number>;
|
|
111
147
|
getNextSequenceNumber(msafeAddress: string): Promise<number>;
|
|
112
|
-
createMSafeAccount(input:
|
|
148
|
+
createMSafeAccount(input: CreateMSafeParams): Promise<void>;
|
|
113
149
|
proposeIntention(input: {
|
|
114
150
|
intention: TxIntention;
|
|
115
151
|
sequenceNumber: number;
|
|
@@ -158,7 +194,6 @@ interface MSafeConfig {
|
|
|
158
194
|
url: string;
|
|
159
195
|
};
|
|
160
196
|
backend: DBConfig;
|
|
161
|
-
apiURL: string;
|
|
162
197
|
}
|
|
163
198
|
interface MSafeConfigOptions {
|
|
164
199
|
suiClient?: {
|
|
@@ -172,8 +207,6 @@ declare const LOCAL_DATABASE_CONFIG: DBConfig;
|
|
|
172
207
|
declare const DEV_DATABASE_CONFIG: DBConfig;
|
|
173
208
|
declare const TESTNET_RPC_URL = "https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD";
|
|
174
209
|
declare const MAINNET_RPC_URL = "https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7";
|
|
175
|
-
declare const LOCAL_API_URL = "http://127.0.0.1:3000";
|
|
176
|
-
declare const DEV_API_URL = "http://13.56.226.148";
|
|
177
210
|
declare const ENV_CONFIGS: Map<MSafeEnv, MSafeConfig>;
|
|
178
211
|
declare function getMSafeConfig(env: MSafeEnv, options?: MSafeConfigOptions): MSafeConfig;
|
|
179
212
|
declare const AUTH_SIGN_MESSAGE = "Welcome to MSafe";
|
|
@@ -218,8 +251,8 @@ declare class PublicKeyHelper {
|
|
|
218
251
|
readonly globals: MSafeGlobals;
|
|
219
252
|
private knownPublicKeys;
|
|
220
253
|
constructor(globals: MSafeGlobals);
|
|
221
|
-
getPublicKey(address: string): Promise<PublicKey
|
|
222
|
-
getPublicKeyBatch(addresses: string[]): Promise<(PublicKey
|
|
254
|
+
getPublicKey(address: string): Promise<PublicKey | undefined>;
|
|
255
|
+
getPublicKeyBatch(addresses: string[]): Promise<(PublicKey | undefined)[]>;
|
|
223
256
|
private _getPublicKey;
|
|
224
257
|
private getPublicKeyFromBackend;
|
|
225
258
|
private getPublicKeyFromChain;
|
|
@@ -269,10 +302,42 @@ interface ProposeIntentionData {
|
|
|
269
302
|
sn: number;
|
|
270
303
|
}
|
|
271
304
|
|
|
305
|
+
interface PublicKeyWithWeight {
|
|
306
|
+
publicKey: PublicKey$1;
|
|
307
|
+
weight: number;
|
|
308
|
+
}
|
|
309
|
+
interface MultiSigConfig {
|
|
310
|
+
threshold: number;
|
|
311
|
+
ownerWithWeight: PublicKeyWithWeight[];
|
|
312
|
+
creationNonce: number | undefined;
|
|
313
|
+
}
|
|
314
|
+
declare const NONCE_PK_PREFIX = "maven";
|
|
315
|
+
declare const NONCE_PREFIX_MAX_SIZE = 16;
|
|
316
|
+
declare const NONCE_PK_WEIGHT = 1;
|
|
317
|
+
declare const MAX_WEIGHT = 255;
|
|
318
|
+
declare const MIN_WEIGHT = 1;
|
|
319
|
+
declare const MAX_OWNER_WITH_NONCE = 9;
|
|
320
|
+
declare const MAX_OWNER_WITHOUT_NONCE = 10;
|
|
321
|
+
declare const MIN_THRESHOLD = 1;
|
|
322
|
+
declare class RawMultiSig {
|
|
323
|
+
readonly config: MultiSigConfig;
|
|
324
|
+
rawMsPK: MultiSigPublicKey;
|
|
325
|
+
constructor(config: MultiSigConfig);
|
|
326
|
+
static fromMSafeAccountInfo(info: MSafeAccountInfo): RawMultiSig;
|
|
327
|
+
get suiAddress(): string;
|
|
328
|
+
get publicKeys(): PublicKeyWithWeight[];
|
|
329
|
+
get threshold(): number;
|
|
330
|
+
combinePartialSignatures(signatures: SerializedSignature[]): SerializedSignature;
|
|
331
|
+
verifyPersonalMessage(messageStr: string, multiSigSignature: SerializedSignature): Promise<boolean>;
|
|
332
|
+
}
|
|
333
|
+
declare function getMultiSigPublicKey(config: MultiSigConfig): MultiSigPublicKey;
|
|
334
|
+
declare function makeNoncePublicKey(nonce: number): Ed25519PublicKey;
|
|
335
|
+
declare function validateMultiSigConfig(config: MultiSigConfig): void;
|
|
336
|
+
|
|
272
337
|
declare class MSafeAccount {
|
|
273
338
|
readonly globals: MSafeGlobals;
|
|
274
339
|
readonly info: MSafeAccountInfo;
|
|
275
|
-
|
|
340
|
+
rawMultiSig: RawMultiSig;
|
|
276
341
|
constructor(globals: MSafeGlobals, info: MSafeAccountInfo);
|
|
277
342
|
static new(globals: MSafeGlobals, address: string): Promise<MSafeAccount>;
|
|
278
343
|
pendingTransactions(): Promise<PendingTx[]>;
|
|
@@ -304,7 +369,7 @@ declare class MSafeClient {
|
|
|
304
369
|
wallet: IWallet;
|
|
305
370
|
jwtToken?: JWTToken;
|
|
306
371
|
}): Promise<JWTToken>;
|
|
307
|
-
userInfo(): Promise<
|
|
372
|
+
userInfo(): Promise<UserWithOwnedMSafe>;
|
|
308
373
|
createAccount(info: CreateMSafeAccountInfo): Promise<string>;
|
|
309
374
|
getMSafeAccount(info: MSafeAccountInfo): MSafeAccount;
|
|
310
375
|
getMSafeAccountFromAddress(msafeAddress: string): Promise<MSafeAccount>;
|
|
@@ -325,11 +390,11 @@ declare class SignatureVerifier {
|
|
|
325
390
|
message: Uint8Array;
|
|
326
391
|
messageType: 'TransactionBlock' | 'Personal';
|
|
327
392
|
signature: SerializedSignature;
|
|
328
|
-
}): Promise<PublicKey>;
|
|
393
|
+
}): Promise<PublicKey$1>;
|
|
329
394
|
static getPublicKeyFromPersonalSignature(input: {
|
|
330
395
|
messageStr: string;
|
|
331
396
|
signature: SerializedSignature;
|
|
332
|
-
}): Promise<PublicKey>;
|
|
397
|
+
}): Promise<PublicKey$1>;
|
|
333
398
|
static verifySignature(input: {
|
|
334
399
|
message: Uint8Array;
|
|
335
400
|
messageType: 'TransactionBlock' | 'Personal';
|
|
@@ -348,14 +413,14 @@ declare class SignatureVerifier {
|
|
|
348
413
|
}): Promise<boolean>;
|
|
349
414
|
}
|
|
350
415
|
declare class PublicKeySerde {
|
|
351
|
-
static ser(publicKey: PublicKey): {
|
|
416
|
+
static ser(publicKey: PublicKey$1): {
|
|
352
417
|
publicKey: string;
|
|
353
|
-
scheme: "ED25519" | "
|
|
418
|
+
scheme: "ED25519" | "Secp256r1" | "Secp256k1" | "MultiSig" | "ZkLogin";
|
|
354
419
|
};
|
|
355
420
|
static de(input: {
|
|
356
421
|
publicKey: string | Uint8Array;
|
|
357
422
|
scheme: SignatureScheme;
|
|
358
|
-
}): PublicKey;
|
|
423
|
+
}): PublicKey$1;
|
|
359
424
|
}
|
|
360
425
|
|
|
361
426
|
declare class Formatter {
|
|
@@ -367,7 +432,7 @@ declare class Formatter {
|
|
|
367
432
|
}
|
|
368
433
|
|
|
369
434
|
declare const SUI_COIN = "0x2::sui::SUI";
|
|
370
|
-
declare function getPublicKeyFromChain(suiClient: SuiClient, address: string): Promise<PublicKey | undefined>;
|
|
435
|
+
declare function getPublicKeyFromChain(suiClient: SuiClient, address: string): Promise<PublicKey$1 | undefined>;
|
|
371
436
|
declare function getAllCoins(input: {
|
|
372
437
|
suiClient: SuiClient;
|
|
373
438
|
owner: string;
|
|
@@ -388,4 +453,4 @@ declare class Coin {
|
|
|
388
453
|
static getBalance(data: SuiObjectData): bigint | undefined;
|
|
389
454
|
}
|
|
390
455
|
|
|
391
|
-
export { AUTH_SIGN_MESSAGE, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig,
|
|
456
|
+
export { AUTH_SIGN_MESSAGE, COIN_TYPE_ARG_REGEX, Coin, CoinHelper, CreateHelper, type CreateMSafeAccountInfo, type CreatePermissionInfo, type DBConfig, DEV_DATABASE_CONFIG, ENV_CONFIGS, Formatter, type FutureIntention, HexToUint8Array, type HistorySendTx, type HistoryVote, type IWallet, IntentionHelper, LOCAL_DATABASE_CONFIG, MAINNET_RPC_URL, MAX_OWNER_WITHOUT_NONCE, MAX_OWNER_WITH_NONCE, MAX_WEIGHT, MIN_THRESHOLD, MIN_WEIGHT, MSafeAccount, type MSafeAccountInfo, MSafeClient, type MSafeConfig, type MSafeConfigOptions, MSafeEnv, MSafeGlobals, MessageHelper, type MultiSigConfig, NONCE_PK_PREFIX, NONCE_PK_WEIGHT, NONCE_PREFIX_MAX_SIZE, type OwnerWithWeight, type OwnerWithWeightPK, type PendingTx, type PendingVote, PublicKeySerde, type PublicKeyWithWeight, RawMultiSig, type ReceiveTransaction, SUI_COIN, SignatureVerifier, TESTNET_RPC_URL, type TxIntention, UNIT_DATABASE_CONFIG, Uint8ArrayToHex, getAllCoins, getMSafeConfig, getMultiSigPublicKey, getPublicKeyFromChain, makeNoncePublicKey, stringToBuffer, validateMultiSigConfig };
|