@nerochain/mpc-sdk 0.1.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/LICENSE +21 -0
- package/README.md +91 -0
- package/dist/aa.d.mts +185 -0
- package/dist/aa.d.ts +185 -0
- package/dist/aa.js +520 -0
- package/dist/aa.js.map +1 -0
- package/dist/aa.mjs +511 -0
- package/dist/aa.mjs.map +1 -0
- package/dist/chain-manager-C3eHsVt9.d.mts +98 -0
- package/dist/chain-manager-C3eHsVt9.d.ts +98 -0
- package/dist/chains.d.mts +17 -0
- package/dist/chains.d.ts +17 -0
- package/dist/chains.js +331 -0
- package/dist/chains.js.map +1 -0
- package/dist/chains.mjs +315 -0
- package/dist/chains.mjs.map +1 -0
- package/dist/index.d.mts +656 -0
- package/dist/index.d.ts +656 -0
- package/dist/index.js +6627 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6502 -0
- package/dist/index.mjs.map +1 -0
- package/dist/modal.d.mts +68 -0
- package/dist/modal.d.ts +68 -0
- package/dist/modal.js +4867 -0
- package/dist/modal.js.map +1 -0
- package/dist/modal.mjs +4850 -0
- package/dist/modal.mjs.map +1 -0
- package/dist/nero-sdk-Cm8gzHZJ.d.mts +684 -0
- package/dist/nero-sdk-IhuTBrXZ.d.ts +684 -0
- package/dist/no-modal.d.mts +56 -0
- package/dist/no-modal.d.ts +56 -0
- package/dist/no-modal.js +4060 -0
- package/dist/no-modal.js.map +1 -0
- package/dist/no-modal.mjs +4041 -0
- package/dist/no-modal.mjs.map +1 -0
- package/dist/react.d.mts +28 -0
- package/dist/react.d.ts +28 -0
- package/dist/react.js +4033 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +4016 -0
- package/dist/react.mjs.map +1 -0
- package/dist/useNeroWallet-PZh940vV.d.ts +164 -0
- package/dist/useNeroWallet-awIYqM6e.d.mts +164 -0
- package/package.json +126 -0
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
import { R as RpcConnection, C as ChainConfig } from './chain-manager-C3eHsVt9.js';
|
|
2
|
+
|
|
3
|
+
interface KeyShare {
|
|
4
|
+
partyId: number;
|
|
5
|
+
privateShare: string;
|
|
6
|
+
publicShare: string;
|
|
7
|
+
commitment: string;
|
|
8
|
+
threshold: number;
|
|
9
|
+
totalParties: number;
|
|
10
|
+
protocolVersion: string;
|
|
11
|
+
}
|
|
12
|
+
interface EncryptedKeyShare {
|
|
13
|
+
ciphertext: string;
|
|
14
|
+
iv: string;
|
|
15
|
+
salt: string;
|
|
16
|
+
version: number;
|
|
17
|
+
}
|
|
18
|
+
interface DKGCommitment {
|
|
19
|
+
partyId: number;
|
|
20
|
+
commitments: string[];
|
|
21
|
+
publicKey: string;
|
|
22
|
+
}
|
|
23
|
+
interface DKGShare {
|
|
24
|
+
fromPartyId: number;
|
|
25
|
+
toPartyId: number;
|
|
26
|
+
encryptedShare: string;
|
|
27
|
+
}
|
|
28
|
+
interface DKGResult {
|
|
29
|
+
success: boolean;
|
|
30
|
+
publicKey?: string;
|
|
31
|
+
walletAddress?: string;
|
|
32
|
+
partyId?: number;
|
|
33
|
+
error?: string;
|
|
34
|
+
}
|
|
35
|
+
interface SigningRequest {
|
|
36
|
+
messageHash: string;
|
|
37
|
+
messageType: "transaction" | "message" | "typed_data";
|
|
38
|
+
metadata?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
interface PartialSignature {
|
|
41
|
+
partyId: number;
|
|
42
|
+
r: string;
|
|
43
|
+
s: string;
|
|
44
|
+
publicShare: string;
|
|
45
|
+
nonceCommitment: string;
|
|
46
|
+
}
|
|
47
|
+
interface Signature {
|
|
48
|
+
r: string;
|
|
49
|
+
s: string;
|
|
50
|
+
v: number;
|
|
51
|
+
fullSignature: string;
|
|
52
|
+
}
|
|
53
|
+
interface SigningResult {
|
|
54
|
+
success: boolean;
|
|
55
|
+
signature?: Signature;
|
|
56
|
+
error?: string;
|
|
57
|
+
}
|
|
58
|
+
type DKGRound = "commitment" | "share_exchange" | "verification" | "complete";
|
|
59
|
+
interface DKGSessionState {
|
|
60
|
+
sessionId: string;
|
|
61
|
+
round: DKGRound;
|
|
62
|
+
partyId: number;
|
|
63
|
+
participantCount: number;
|
|
64
|
+
threshold: number;
|
|
65
|
+
commitments: Map<number, DKGCommitment>;
|
|
66
|
+
receivedShares: Map<number, DKGShare>;
|
|
67
|
+
polynomial?: bigint[];
|
|
68
|
+
privateShare?: bigint;
|
|
69
|
+
publicKey?: string;
|
|
70
|
+
}
|
|
71
|
+
type SigningRound = "nonce_commitment" | "nonce_exchange" | "partial_signature" | "complete";
|
|
72
|
+
interface SigningSessionState {
|
|
73
|
+
sessionId: string;
|
|
74
|
+
round: SigningRound;
|
|
75
|
+
messageHash: string;
|
|
76
|
+
participatingParties: number[];
|
|
77
|
+
nonceCommitments: Map<number, string>;
|
|
78
|
+
partialSignatures: Map<number, PartialSignature>;
|
|
79
|
+
}
|
|
80
|
+
interface UIConfig {
|
|
81
|
+
appName: string;
|
|
82
|
+
logoLight?: string;
|
|
83
|
+
logoDark?: string;
|
|
84
|
+
mode?: "light" | "dark" | "auto";
|
|
85
|
+
theme?: {
|
|
86
|
+
primary?: string;
|
|
87
|
+
secondary?: string;
|
|
88
|
+
background?: string;
|
|
89
|
+
text?: string;
|
|
90
|
+
border?: string;
|
|
91
|
+
};
|
|
92
|
+
defaultLanguage?: string;
|
|
93
|
+
}
|
|
94
|
+
interface SDKConfig {
|
|
95
|
+
backendUrl: string;
|
|
96
|
+
chainId?: number;
|
|
97
|
+
wsUrl?: string;
|
|
98
|
+
storagePrefix?: string;
|
|
99
|
+
autoConnect?: boolean;
|
|
100
|
+
uiConfig?: UIConfig;
|
|
101
|
+
sessionTime?: number;
|
|
102
|
+
web3AuthClientId?: string;
|
|
103
|
+
}
|
|
104
|
+
interface AuthTokens {
|
|
105
|
+
accessToken: string;
|
|
106
|
+
refreshToken: string;
|
|
107
|
+
expiresAt: number;
|
|
108
|
+
}
|
|
109
|
+
interface User {
|
|
110
|
+
id: string;
|
|
111
|
+
email?: string;
|
|
112
|
+
displayName?: string;
|
|
113
|
+
profilePicture?: string;
|
|
114
|
+
walletAddress?: string;
|
|
115
|
+
createdAt: Date;
|
|
116
|
+
}
|
|
117
|
+
interface DeviceFingerprint {
|
|
118
|
+
userAgent: string;
|
|
119
|
+
ipAddress?: string;
|
|
120
|
+
additionalData?: string;
|
|
121
|
+
}
|
|
122
|
+
interface WalletInfo {
|
|
123
|
+
eoaAddress: string;
|
|
124
|
+
smartWalletAddress?: string;
|
|
125
|
+
publicKey: string;
|
|
126
|
+
chainId: number;
|
|
127
|
+
}
|
|
128
|
+
type ProtocolMessageType = "dkg:commitment" | "dkg:share" | "dkg:verification" | "dkg:complete" | "signing:nonce_commitment" | "signing:nonce" | "signing:partial_signature" | "signing:complete" | "error";
|
|
129
|
+
interface ProtocolMessage {
|
|
130
|
+
type: ProtocolMessageType;
|
|
131
|
+
sessionId: string;
|
|
132
|
+
fromPartyId: number;
|
|
133
|
+
toPartyId?: number;
|
|
134
|
+
payload: unknown;
|
|
135
|
+
timestamp: number;
|
|
136
|
+
signature?: string;
|
|
137
|
+
}
|
|
138
|
+
interface StorageAdapter {
|
|
139
|
+
get(key: string): Promise<string | null>;
|
|
140
|
+
set(key: string, value: string): Promise<void>;
|
|
141
|
+
delete(key: string): Promise<void>;
|
|
142
|
+
clear(): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
declare class SDKError extends Error {
|
|
145
|
+
code: string;
|
|
146
|
+
statusCode?: number | undefined;
|
|
147
|
+
constructor(message: string, code: string, statusCode?: number | undefined);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface RequestArguments {
|
|
151
|
+
readonly method: string;
|
|
152
|
+
readonly params?: readonly unknown[] | object;
|
|
153
|
+
}
|
|
154
|
+
interface ProviderRpcError extends Error {
|
|
155
|
+
code: number;
|
|
156
|
+
data?: unknown;
|
|
157
|
+
}
|
|
158
|
+
interface ProviderConnectInfo {
|
|
159
|
+
readonly chainId: string;
|
|
160
|
+
}
|
|
161
|
+
interface EIP1193Provider {
|
|
162
|
+
request(args: RequestArguments): Promise<unknown>;
|
|
163
|
+
on(event: "connect", listener: (info: ProviderConnectInfo) => void): this;
|
|
164
|
+
on(event: "disconnect", listener: (error: ProviderRpcError) => void): this;
|
|
165
|
+
on(event: "chainChanged", listener: (chainId: string) => void): this;
|
|
166
|
+
on(event: "accountsChanged", listener: (accounts: string[]) => void): this;
|
|
167
|
+
on(event: "message", listener: (message: ProviderMessage) => void): this;
|
|
168
|
+
on(event: string, listener: (...args: unknown[]) => void): this;
|
|
169
|
+
removeListener(event: string, listener: (...args: unknown[]) => void): this;
|
|
170
|
+
removeAllListeners(event?: string): this;
|
|
171
|
+
}
|
|
172
|
+
interface ProviderMessage {
|
|
173
|
+
readonly type: string;
|
|
174
|
+
readonly data: unknown;
|
|
175
|
+
}
|
|
176
|
+
interface AddEthereumChainParameter {
|
|
177
|
+
chainId: string;
|
|
178
|
+
chainName: string;
|
|
179
|
+
nativeCurrency: {
|
|
180
|
+
name: string;
|
|
181
|
+
symbol: string;
|
|
182
|
+
decimals: number;
|
|
183
|
+
};
|
|
184
|
+
rpcUrls: string[];
|
|
185
|
+
blockExplorerUrls?: string[];
|
|
186
|
+
iconUrls?: string[];
|
|
187
|
+
}
|
|
188
|
+
interface WatchAssetParams {
|
|
189
|
+
type: "ERC20" | "ERC721" | "ERC1155";
|
|
190
|
+
options: {
|
|
191
|
+
address: string;
|
|
192
|
+
symbol?: string;
|
|
193
|
+
decimals?: number;
|
|
194
|
+
image?: string;
|
|
195
|
+
tokenId?: string;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
interface TransactionParams {
|
|
199
|
+
from: string;
|
|
200
|
+
to?: string;
|
|
201
|
+
value?: string;
|
|
202
|
+
gas?: string;
|
|
203
|
+
gasPrice?: string;
|
|
204
|
+
maxFeePerGas?: string;
|
|
205
|
+
maxPriorityFeePerGas?: string;
|
|
206
|
+
data?: string;
|
|
207
|
+
nonce?: string;
|
|
208
|
+
}
|
|
209
|
+
interface TypedDataDomain {
|
|
210
|
+
name?: string;
|
|
211
|
+
version?: string;
|
|
212
|
+
chainId?: number | string;
|
|
213
|
+
verifyingContract?: string;
|
|
214
|
+
salt?: string;
|
|
215
|
+
}
|
|
216
|
+
interface TypedDataField {
|
|
217
|
+
name: string;
|
|
218
|
+
type: string;
|
|
219
|
+
}
|
|
220
|
+
type TypedDataTypes = Record<string, TypedDataField[]>;
|
|
221
|
+
interface TypedDataMessage {
|
|
222
|
+
[key: string]: unknown;
|
|
223
|
+
}
|
|
224
|
+
declare const EIP1193_ERROR_CODES: {
|
|
225
|
+
readonly USER_REJECTED: 4001;
|
|
226
|
+
readonly UNAUTHORIZED: 4100;
|
|
227
|
+
readonly UNSUPPORTED_METHOD: 4200;
|
|
228
|
+
readonly DISCONNECTED: 4900;
|
|
229
|
+
readonly CHAIN_DISCONNECTED: 4901;
|
|
230
|
+
readonly INVALID_PARAMS: -32602;
|
|
231
|
+
readonly INTERNAL_ERROR: -32603;
|
|
232
|
+
readonly CHAIN_NOT_ADDED: 4902;
|
|
233
|
+
};
|
|
234
|
+
declare function createProviderRpcError(code: number, message: string, data?: unknown): ProviderRpcError;
|
|
235
|
+
|
|
236
|
+
declare class APIClient {
|
|
237
|
+
private baseUrl;
|
|
238
|
+
private tokens;
|
|
239
|
+
private refreshPromise;
|
|
240
|
+
constructor(config: SDKConfig);
|
|
241
|
+
setTokens(tokens: AuthTokens): void;
|
|
242
|
+
getTokens(): AuthTokens | null;
|
|
243
|
+
clearTokens(): void;
|
|
244
|
+
private request;
|
|
245
|
+
private refreshAccessToken;
|
|
246
|
+
getOAuthUrl(provider: "google" | "github" | "apple", redirectUri: string): Promise<{
|
|
247
|
+
url: string;
|
|
248
|
+
state: string;
|
|
249
|
+
}>;
|
|
250
|
+
handleOAuthCallback(provider: string, code: string, state: string, fingerprint: DeviceFingerprint): Promise<{
|
|
251
|
+
user: User;
|
|
252
|
+
tokens: AuthTokens;
|
|
253
|
+
wallet?: WalletInfo;
|
|
254
|
+
requiresDKG: boolean;
|
|
255
|
+
}>;
|
|
256
|
+
getCurrentUser(): Promise<User>;
|
|
257
|
+
logout(): Promise<void>;
|
|
258
|
+
initiateDKG(): Promise<{
|
|
259
|
+
sessionId: string;
|
|
260
|
+
partyId: number;
|
|
261
|
+
participantCount: number;
|
|
262
|
+
threshold: number;
|
|
263
|
+
}>;
|
|
264
|
+
submitDKGCommitment(sessionId: string, commitment: {
|
|
265
|
+
partyId: number;
|
|
266
|
+
commitments: string[];
|
|
267
|
+
publicKey: string;
|
|
268
|
+
proofOfKnowledge: string;
|
|
269
|
+
}): Promise<void>;
|
|
270
|
+
getDKGCommitments(sessionId: string): Promise<{
|
|
271
|
+
commitments: Array<{
|
|
272
|
+
partyId: number;
|
|
273
|
+
commitments: string[];
|
|
274
|
+
publicKey: string;
|
|
275
|
+
proofOfKnowledge?: string;
|
|
276
|
+
}>;
|
|
277
|
+
ready: boolean;
|
|
278
|
+
}>;
|
|
279
|
+
submitDKGShare(sessionId: string, encryptedShare: string, toPartyId: number): Promise<void>;
|
|
280
|
+
getDKGShares(sessionId: string, partyId: number): Promise<{
|
|
281
|
+
shares: Array<{
|
|
282
|
+
fromPartyId: number;
|
|
283
|
+
encryptedShare: string;
|
|
284
|
+
}>;
|
|
285
|
+
ready: boolean;
|
|
286
|
+
}>;
|
|
287
|
+
completeDKG(sessionId: string, partyId: number, publicKey: string, walletAddress: string): Promise<{
|
|
288
|
+
success: boolean;
|
|
289
|
+
wallet: WalletInfo;
|
|
290
|
+
}>;
|
|
291
|
+
initiateSigningSession(messageHash: string, messageType: "transaction" | "message" | "typed_data"): Promise<{
|
|
292
|
+
sessionId: string;
|
|
293
|
+
participatingParties: number[];
|
|
294
|
+
}>;
|
|
295
|
+
submitNonceCommitment(sessionId: string, partyId: number, commitment: string): Promise<void>;
|
|
296
|
+
getNonceCommitments(sessionId: string): Promise<{
|
|
297
|
+
commitments: Map<number, string>;
|
|
298
|
+
ready: boolean;
|
|
299
|
+
}>;
|
|
300
|
+
submitPartialSignature(sessionId: string, partyId: number, partialSignature: {
|
|
301
|
+
r: string;
|
|
302
|
+
s: string;
|
|
303
|
+
publicShare: string;
|
|
304
|
+
nonceCommitment: string;
|
|
305
|
+
}): Promise<void>;
|
|
306
|
+
getPartialSignatures(sessionId: string): Promise<{
|
|
307
|
+
partials: Array<{
|
|
308
|
+
partyId: number;
|
|
309
|
+
s: string;
|
|
310
|
+
publicShare: string;
|
|
311
|
+
nonceCommitment: string;
|
|
312
|
+
}>;
|
|
313
|
+
ready: boolean;
|
|
314
|
+
}>;
|
|
315
|
+
getSigningResult(sessionId: string): Promise<{
|
|
316
|
+
complete: boolean;
|
|
317
|
+
signature?: {
|
|
318
|
+
r: string;
|
|
319
|
+
s: string;
|
|
320
|
+
v: number;
|
|
321
|
+
fullSignature: string;
|
|
322
|
+
};
|
|
323
|
+
}>;
|
|
324
|
+
getWalletInfo(): Promise<WalletInfo>;
|
|
325
|
+
getPartyPublicShares(): Promise<{
|
|
326
|
+
shares: Array<{
|
|
327
|
+
partyId: number;
|
|
328
|
+
publicShare: string;
|
|
329
|
+
}>;
|
|
330
|
+
}>;
|
|
331
|
+
dklsKeygenInit(): Promise<{
|
|
332
|
+
sessionId: string;
|
|
333
|
+
backendCommitment: {
|
|
334
|
+
partyId: number;
|
|
335
|
+
commitment: string;
|
|
336
|
+
};
|
|
337
|
+
}>;
|
|
338
|
+
dklsKeygenCommitment(sessionId: string, clientCommitment: {
|
|
339
|
+
partyId: number;
|
|
340
|
+
commitment: string;
|
|
341
|
+
}): Promise<{
|
|
342
|
+
sessionId: string;
|
|
343
|
+
backendPublicShare: {
|
|
344
|
+
partyId: number;
|
|
345
|
+
publicShare: string;
|
|
346
|
+
proof: {
|
|
347
|
+
commitment: string;
|
|
348
|
+
challenge: string;
|
|
349
|
+
response: string;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
}>;
|
|
353
|
+
dklsKeygenComplete(sessionId: string, clientPublicShare: {
|
|
354
|
+
partyId: number;
|
|
355
|
+
publicShare: string;
|
|
356
|
+
proof: {
|
|
357
|
+
commitment: string;
|
|
358
|
+
challenge: string;
|
|
359
|
+
response: string;
|
|
360
|
+
};
|
|
361
|
+
}): Promise<{
|
|
362
|
+
sessionId: string;
|
|
363
|
+
walletAddress: string;
|
|
364
|
+
jointPublicKey: string;
|
|
365
|
+
keyId: string;
|
|
366
|
+
}>;
|
|
367
|
+
dklsSigningInit(params: {
|
|
368
|
+
messageHash: string;
|
|
369
|
+
messageType?: "message" | "transaction" | "typed_data";
|
|
370
|
+
dkgSessionId: string;
|
|
371
|
+
}): Promise<{
|
|
372
|
+
sessionId: string;
|
|
373
|
+
status: string;
|
|
374
|
+
backendNonceCommitment: {
|
|
375
|
+
partyId: number;
|
|
376
|
+
commitment: string;
|
|
377
|
+
};
|
|
378
|
+
walletAddress: string;
|
|
379
|
+
}>;
|
|
380
|
+
dklsSigningNonce(sessionId: string, clientNonceCommitment: {
|
|
381
|
+
partyId: number;
|
|
382
|
+
R: string;
|
|
383
|
+
commitment: string;
|
|
384
|
+
}): Promise<{
|
|
385
|
+
sessionId: string;
|
|
386
|
+
r: string;
|
|
387
|
+
rValue: string;
|
|
388
|
+
backendNonceReveal: {
|
|
389
|
+
partyId: number;
|
|
390
|
+
R: string;
|
|
391
|
+
};
|
|
392
|
+
backendPartialSignature: {
|
|
393
|
+
partyId: number;
|
|
394
|
+
sigma: string;
|
|
395
|
+
R: string;
|
|
396
|
+
};
|
|
397
|
+
}>;
|
|
398
|
+
/**
|
|
399
|
+
* @deprecated This method defeats threshold security by transmitting the full key share.
|
|
400
|
+
* Use the MtA-based signing flow instead: dklsMtaRound1 -> dklsMtaRound2 -> dklsSigningPartial.
|
|
401
|
+
* This endpoint is only available in test mode (DKLS_LOCAL_TESTING_MODE=true).
|
|
402
|
+
*/
|
|
403
|
+
dklsSigningComplete(sessionId: string, clientKeyShare: {
|
|
404
|
+
partyId: number;
|
|
405
|
+
secretShare: string;
|
|
406
|
+
publicShare: string;
|
|
407
|
+
jointPublicKey: string;
|
|
408
|
+
}): Promise<{
|
|
409
|
+
sessionId: string;
|
|
410
|
+
signature: string;
|
|
411
|
+
r: string;
|
|
412
|
+
s: string;
|
|
413
|
+
v: number;
|
|
414
|
+
messageHash: string;
|
|
415
|
+
walletAddress: string | null;
|
|
416
|
+
securityLevel: string;
|
|
417
|
+
}>;
|
|
418
|
+
dklsSigningStatus(sessionId: string): Promise<{
|
|
419
|
+
sessionId: string;
|
|
420
|
+
status: string;
|
|
421
|
+
messageHash: string;
|
|
422
|
+
messageType: string;
|
|
423
|
+
result?: {
|
|
424
|
+
signature: string;
|
|
425
|
+
r: string;
|
|
426
|
+
s: string;
|
|
427
|
+
v: number;
|
|
428
|
+
};
|
|
429
|
+
error?: string;
|
|
430
|
+
createdAt: string;
|
|
431
|
+
completedAt?: string;
|
|
432
|
+
}>;
|
|
433
|
+
dklsSigningCancel(sessionId: string): Promise<{
|
|
434
|
+
sessionId: string;
|
|
435
|
+
message: string;
|
|
436
|
+
}>;
|
|
437
|
+
dklsMtaRound1(sessionId: string, mta1Setup: {
|
|
438
|
+
sessionId: string;
|
|
439
|
+
setup: {
|
|
440
|
+
setups: Array<{
|
|
441
|
+
A: string;
|
|
442
|
+
}>;
|
|
443
|
+
};
|
|
444
|
+
}, mta2Setup: {
|
|
445
|
+
sessionId: string;
|
|
446
|
+
setup: {
|
|
447
|
+
setups: Array<{
|
|
448
|
+
A: string;
|
|
449
|
+
}>;
|
|
450
|
+
};
|
|
451
|
+
}): Promise<{
|
|
452
|
+
mta1Response: {
|
|
453
|
+
sessionId: string;
|
|
454
|
+
response: {
|
|
455
|
+
responses: Array<{
|
|
456
|
+
B: string;
|
|
457
|
+
}>;
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
mta2Response: {
|
|
461
|
+
sessionId: string;
|
|
462
|
+
response: {
|
|
463
|
+
responses: Array<{
|
|
464
|
+
B: string;
|
|
465
|
+
}>;
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
}>;
|
|
469
|
+
dklsMtaRound2(sessionId: string, mta1Encrypted: {
|
|
470
|
+
sessionId: string;
|
|
471
|
+
encrypted: {
|
|
472
|
+
encrypted: Array<{
|
|
473
|
+
e0: string;
|
|
474
|
+
e1: string;
|
|
475
|
+
}>;
|
|
476
|
+
};
|
|
477
|
+
}, mta2Encrypted: {
|
|
478
|
+
sessionId: string;
|
|
479
|
+
encrypted: {
|
|
480
|
+
encrypted: Array<{
|
|
481
|
+
e0: string;
|
|
482
|
+
e1: string;
|
|
483
|
+
}>;
|
|
484
|
+
};
|
|
485
|
+
}): Promise<{
|
|
486
|
+
success: true;
|
|
487
|
+
}>;
|
|
488
|
+
dklsSigningPartial(sessionId: string, clientPartialSignature: {
|
|
489
|
+
partyId: number;
|
|
490
|
+
s: string;
|
|
491
|
+
}): Promise<{
|
|
492
|
+
signature: string;
|
|
493
|
+
r: string;
|
|
494
|
+
s: string;
|
|
495
|
+
v: number;
|
|
496
|
+
}>;
|
|
497
|
+
initiateDeviceVerification(fingerprint: DeviceFingerprint, deviceName?: string): Promise<{
|
|
498
|
+
verificationId: string;
|
|
499
|
+
expiresAt: string;
|
|
500
|
+
}>;
|
|
501
|
+
completeDeviceVerification(verificationId: string, code: string, fingerprint: DeviceFingerprint): Promise<{
|
|
502
|
+
deviceId: string;
|
|
503
|
+
trustLevel: string;
|
|
504
|
+
}>;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
interface UserOperation {
|
|
508
|
+
sender: string;
|
|
509
|
+
nonce: bigint;
|
|
510
|
+
initCode: string;
|
|
511
|
+
callData: string;
|
|
512
|
+
callGasLimit: bigint;
|
|
513
|
+
verificationGasLimit: bigint;
|
|
514
|
+
preVerificationGas: bigint;
|
|
515
|
+
maxFeePerGas: bigint;
|
|
516
|
+
maxPriorityFeePerGas: bigint;
|
|
517
|
+
paymasterAndData: string;
|
|
518
|
+
signature: string;
|
|
519
|
+
}
|
|
520
|
+
interface TransactionRequest {
|
|
521
|
+
to: string;
|
|
522
|
+
value?: bigint;
|
|
523
|
+
data?: string;
|
|
524
|
+
}
|
|
525
|
+
interface SmartWalletConfig {
|
|
526
|
+
apiClient: APIClient;
|
|
527
|
+
keyShare: KeyShare;
|
|
528
|
+
partyPublicShares: Map<number, string>;
|
|
529
|
+
publicKey: string;
|
|
530
|
+
chainId: number;
|
|
531
|
+
rpcConnection: RpcConnection;
|
|
532
|
+
bundlerUrl: string;
|
|
533
|
+
entryPointAddress?: string;
|
|
534
|
+
factoryAddress?: string;
|
|
535
|
+
paymasterUrl?: string;
|
|
536
|
+
}
|
|
537
|
+
declare class SmartWallet {
|
|
538
|
+
private apiClient;
|
|
539
|
+
private keyShare;
|
|
540
|
+
private partyPublicShares;
|
|
541
|
+
private publicKey;
|
|
542
|
+
private chainId;
|
|
543
|
+
private rpcConnection;
|
|
544
|
+
private bundlerUrl;
|
|
545
|
+
private entryPointAddress;
|
|
546
|
+
private factoryAddress;
|
|
547
|
+
private paymasterUrl?;
|
|
548
|
+
private _eoaAddress;
|
|
549
|
+
private _smartWalletAddress;
|
|
550
|
+
private _isDeployed;
|
|
551
|
+
private _cachedNonce;
|
|
552
|
+
constructor(config: SmartWalletConfig);
|
|
553
|
+
get eoaAddress(): string;
|
|
554
|
+
/**
|
|
555
|
+
* @deprecated Use getSmartWalletAddress() instead.
|
|
556
|
+
*/
|
|
557
|
+
get smartWalletAddress(): string;
|
|
558
|
+
getSmartWalletAddress(): Promise<string>;
|
|
559
|
+
getWalletInfo(): Promise<WalletInfo>;
|
|
560
|
+
buildUserOperation(transactions: TransactionRequest | TransactionRequest[]): Promise<UserOperation>;
|
|
561
|
+
signUserOperation(userOp: UserOperation): Promise<UserOperation>;
|
|
562
|
+
sendUserOperation(userOp: UserOperation): Promise<{
|
|
563
|
+
userOpHash: string;
|
|
564
|
+
wait: () => Promise<void>;
|
|
565
|
+
}>;
|
|
566
|
+
private waitForUserOperationReceipt;
|
|
567
|
+
private userOpToHex;
|
|
568
|
+
signMessage(message: string | Uint8Array): Promise<Signature>;
|
|
569
|
+
signTypedData(domain: Record<string, unknown>, types: Record<string, Array<{
|
|
570
|
+
name: string;
|
|
571
|
+
type: string;
|
|
572
|
+
}>>, primaryType: string, value: Record<string, unknown>): Promise<Signature>;
|
|
573
|
+
private computeUserOpHash;
|
|
574
|
+
private packUserOp;
|
|
575
|
+
private encodeExecuteBatch;
|
|
576
|
+
private getInitCode;
|
|
577
|
+
private getNonce;
|
|
578
|
+
private isDeployed;
|
|
579
|
+
private getFeeData;
|
|
580
|
+
private getPaymasterData;
|
|
581
|
+
private hashTypedDataDomain;
|
|
582
|
+
private hashTypedDataStruct;
|
|
583
|
+
private encodeType;
|
|
584
|
+
private formatType;
|
|
585
|
+
private findTypeDependencies;
|
|
586
|
+
private hashType;
|
|
587
|
+
private hashStruct;
|
|
588
|
+
private encodeField;
|
|
589
|
+
}
|
|
590
|
+
declare function createSmartWallet(config: SmartWalletConfig): SmartWallet;
|
|
591
|
+
|
|
592
|
+
type OAuthProvider = "google" | "github" | "apple";
|
|
593
|
+
type LoginProvider = OAuthProvider;
|
|
594
|
+
interface NeroSDKState {
|
|
595
|
+
isAuthenticated: boolean;
|
|
596
|
+
isInitialized: boolean;
|
|
597
|
+
hasWallet: boolean;
|
|
598
|
+
user: User | null;
|
|
599
|
+
walletInfo: WalletInfo | null;
|
|
600
|
+
chainId: number;
|
|
601
|
+
isConnected: boolean;
|
|
602
|
+
}
|
|
603
|
+
type ConnectionStatus = "connected" | "disconnected" | "connecting" | "errored";
|
|
604
|
+
interface UserInfo {
|
|
605
|
+
email?: string;
|
|
606
|
+
name?: string;
|
|
607
|
+
profileImage?: string;
|
|
608
|
+
verifier?: string;
|
|
609
|
+
verifierId?: string;
|
|
610
|
+
aggregateVerifier?: string;
|
|
611
|
+
typeOfLogin?: string;
|
|
612
|
+
dappShare?: string;
|
|
613
|
+
idToken?: string;
|
|
614
|
+
oAuthIdToken?: string;
|
|
615
|
+
oAuthAccessToken?: string;
|
|
616
|
+
}
|
|
617
|
+
declare class NeroMpcSDK {
|
|
618
|
+
private config;
|
|
619
|
+
private apiClient;
|
|
620
|
+
private wsClient;
|
|
621
|
+
private keyManager;
|
|
622
|
+
private deviceKey;
|
|
623
|
+
private chainManager;
|
|
624
|
+
private _user;
|
|
625
|
+
private _wallet;
|
|
626
|
+
private _publicKey;
|
|
627
|
+
private _partyPublicShares;
|
|
628
|
+
private _provider;
|
|
629
|
+
private _chainId;
|
|
630
|
+
private _connectionStatus;
|
|
631
|
+
private _customChains;
|
|
632
|
+
private _cachedWalletInfo;
|
|
633
|
+
constructor(config: SDKConfig);
|
|
634
|
+
get isAuthenticated(): boolean;
|
|
635
|
+
get hasWallet(): boolean;
|
|
636
|
+
get user(): User | null;
|
|
637
|
+
get wallet(): SmartWallet | null;
|
|
638
|
+
get chainId(): number;
|
|
639
|
+
get connected(): boolean;
|
|
640
|
+
get status(): ConnectionStatus;
|
|
641
|
+
get provider(): EIP1193Provider | null;
|
|
642
|
+
get state(): NeroSDKState;
|
|
643
|
+
getWalletInfo(): Promise<WalletInfo | null>;
|
|
644
|
+
initialize(): Promise<void>;
|
|
645
|
+
getOAuthUrl(provider: OAuthProvider, redirectUri: string): Promise<{
|
|
646
|
+
url: string;
|
|
647
|
+
state: string;
|
|
648
|
+
}>;
|
|
649
|
+
handleOAuthCallback(provider: OAuthProvider, code: string, state: string): Promise<{
|
|
650
|
+
user: User;
|
|
651
|
+
requiresDKG: boolean;
|
|
652
|
+
}>;
|
|
653
|
+
loginWithGoogle(redirectUri?: string): Promise<void>;
|
|
654
|
+
loginWithGithub(redirectUri?: string): Promise<void>;
|
|
655
|
+
loginWithApple(redirectUri?: string): Promise<void>;
|
|
656
|
+
generateWallet(): Promise<WalletInfo>;
|
|
657
|
+
logout(): Promise<void>;
|
|
658
|
+
connect(): Promise<EIP1193Provider>;
|
|
659
|
+
disconnect(): Promise<void>;
|
|
660
|
+
getProvider(): EIP1193Provider | null;
|
|
661
|
+
getUserInfo(): UserInfo | null;
|
|
662
|
+
switchChain(chainId: number): Promise<void>;
|
|
663
|
+
addChain(config: ChainConfig): void;
|
|
664
|
+
getChainConfig(chainId?: number): ChainConfig | undefined;
|
|
665
|
+
getSupportedChainIds(): number[];
|
|
666
|
+
private getAccounts;
|
|
667
|
+
private signMessageInternal;
|
|
668
|
+
private signTypedDataInternal;
|
|
669
|
+
private sendTransactionInternal;
|
|
670
|
+
private handleChainChanged;
|
|
671
|
+
private getChainConfigForId;
|
|
672
|
+
private createSmartWallet;
|
|
673
|
+
exportBackup(password: string): Promise<string>;
|
|
674
|
+
importBackup(backupString: string, password: string): Promise<void>;
|
|
675
|
+
private initializeWallet;
|
|
676
|
+
private getDeviceFingerprint;
|
|
677
|
+
private loadOrGenerateDeviceKey;
|
|
678
|
+
private storeTokens;
|
|
679
|
+
private loadStoredTokens;
|
|
680
|
+
private clearStoredTokens;
|
|
681
|
+
}
|
|
682
|
+
declare function createNeroSDK(config: SDKConfig): NeroMpcSDK;
|
|
683
|
+
|
|
684
|
+
export { APIClient as A, type TypedDataField as B, type ConnectionStatus as C, type DKGResult as D, type EIP1193Provider as E, type TypedDataMessage as F, type TypedDataTypes as G, type UIConfig as H, type UserInfo as I, type WatchAssetParams as J, type KeyShare as K, type LoginProvider as L, createNeroSDK as M, NeroMpcSDK as N, type OAuthProvider as O, type ProtocolMessage as P, createProviderRpcError as Q, type RequestArguments as R, type SDKConfig as S, type TransactionParams as T, type User as U, createSmartWallet as V, type WalletInfo as W, type UserOperation as X, type NeroSDKState as a, type Signature as b, type StorageAdapter as c, type ProtocolMessageType as d, type SigningRequest as e, type SigningResult as f, type AddEthereumChainParameter as g, type AuthTokens as h, type DKGCommitment as i, type DKGRound as j, type DKGSessionState as k, type DKGShare as l, type DeviceFingerprint as m, EIP1193_ERROR_CODES as n, type EncryptedKeyShare as o, type PartialSignature as p, type ProviderConnectInfo as q, type ProviderMessage as r, type ProviderRpcError as s, SDKError as t, type SigningRound as u, type SigningSessionState as v, SmartWallet as w, type SmartWalletConfig as x, type TransactionRequest as y, type TypedDataDomain as z };
|