@portal-hq/utils 4.6.0 → 4.7.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/lib/commonjs/definitions/index.js +1 -0
- package/lib/commonjs/eth-requests/index.js +6 -0
- package/lib/commonjs/events/index.js +1 -0
- package/lib/commonjs/version/version.json +1 -1
- package/lib/esm/definitions/index.js +1 -0
- package/lib/esm/eth-requests/index.js +6 -0
- package/lib/esm/events/index.js +1 -0
- package/lib/esm/version/version.json +1 -1
- package/package.json +2 -2
- package/src/definitions/index.ts +16 -0
- package/src/eth-requests/index.ts +7 -0
- package/src/events/index.ts +1 -0
- package/src/index.ts +5 -0
- package/src/version/version.json +1 -1
- package/types.d.ts +197 -1
|
@@ -19,6 +19,7 @@ var PortalRequestMethod;
|
|
|
19
19
|
PortalRequestMethod["EthSendRawTransaction"] = "eth_sendRawTransaction";
|
|
20
20
|
PortalRequestMethod["EthSign"] = "eth_sign";
|
|
21
21
|
PortalRequestMethod["EthSignTransaction"] = "eth_signTransaction";
|
|
22
|
+
PortalRequestMethod["EthSignUserOperation"] = "eth_signUserOperation";
|
|
22
23
|
PortalRequestMethod["EthSignTypedDataV3"] = "eth_signTypedData_v3";
|
|
23
24
|
PortalRequestMethod["EthSignTypedDataV4"] = "eth_signTypedData_v4";
|
|
24
25
|
PortalRequestMethod["PersonalSign"] = "personal_sign";
|
|
@@ -77,6 +77,12 @@ const parseRequest = (method, params) => __awaiter(void 0, void 0, void 0, funct
|
|
|
77
77
|
data: requestData,
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
+
case 'eth_signUserOperation': {
|
|
81
|
+
return {
|
|
82
|
+
method,
|
|
83
|
+
data: txParam0,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
80
86
|
case 'eth_sign':
|
|
81
87
|
case 'personal_sign':
|
|
82
88
|
case 'eth_signTypedData_v3':
|
|
@@ -19,6 +19,7 @@ var Events;
|
|
|
19
19
|
Events["GetSigningShareMetadata"] = "Get Signing Share Metadata";
|
|
20
20
|
Events["GetSources"] = "Get Sources";
|
|
21
21
|
Events["GetTransactions"] = "Get Transactions";
|
|
22
|
+
Events["GetTransactionHistory"] = "Get Transaction History";
|
|
22
23
|
Events["PrepareClientEject"] = "Prepare Client Eject";
|
|
23
24
|
Events["SimulateTransaction"] = "Simulate Transaction";
|
|
24
25
|
Events["EvaluateTransaction"] = "Evaluate Transaction";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "version": "4.
|
|
1
|
+
{ "version": "4.7.0" }
|
|
@@ -16,6 +16,7 @@ export var PortalRequestMethod;
|
|
|
16
16
|
PortalRequestMethod["EthSendRawTransaction"] = "eth_sendRawTransaction";
|
|
17
17
|
PortalRequestMethod["EthSign"] = "eth_sign";
|
|
18
18
|
PortalRequestMethod["EthSignTransaction"] = "eth_signTransaction";
|
|
19
|
+
PortalRequestMethod["EthSignUserOperation"] = "eth_signUserOperation";
|
|
19
20
|
PortalRequestMethod["EthSignTypedDataV3"] = "eth_signTypedData_v3";
|
|
20
21
|
PortalRequestMethod["EthSignTypedDataV4"] = "eth_signTypedData_v4";
|
|
21
22
|
PortalRequestMethod["PersonalSign"] = "personal_sign";
|
|
@@ -70,6 +70,12 @@ export const parseRequest = (method, params) => __awaiter(void 0, void 0, void 0
|
|
|
70
70
|
data: requestData,
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
+
case 'eth_signUserOperation': {
|
|
74
|
+
return {
|
|
75
|
+
method,
|
|
76
|
+
data: txParam0,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
73
79
|
case 'eth_sign':
|
|
74
80
|
case 'personal_sign':
|
|
75
81
|
case 'eth_signTypedData_v3':
|
package/lib/esm/events/index.js
CHANGED
|
@@ -17,6 +17,7 @@ var Events;
|
|
|
17
17
|
Events["GetSigningShareMetadata"] = "Get Signing Share Metadata";
|
|
18
18
|
Events["GetSources"] = "Get Sources";
|
|
19
19
|
Events["GetTransactions"] = "Get Transactions";
|
|
20
|
+
Events["GetTransactionHistory"] = "Get Transaction History";
|
|
20
21
|
Events["PrepareClientEject"] = "Prepare Client Eject";
|
|
21
22
|
Events["SimulateTransaction"] = "Simulate Transaction";
|
|
22
23
|
Events["EvaluateTransaction"] = "Evaluate Transaction";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "version": "4.
|
|
1
|
+
{ "version": "4.7.0" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portal-hq/utils",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"main": "lib/commonjs/index",
|
|
5
5
|
"module": "lib/esm/index",
|
|
6
6
|
"source": "src/index",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"ts-jest": "^29.0.3",
|
|
27
27
|
"typescript": "^4.8.4"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "3125e96a72c384e33229138b63ff3791818b0833"
|
|
30
30
|
}
|
package/src/definitions/index.ts
CHANGED
|
@@ -38,6 +38,8 @@ import type {
|
|
|
38
38
|
Dapp,
|
|
39
39
|
EvaluateTransactionParam,
|
|
40
40
|
GenerateResponse,
|
|
41
|
+
GetTransactionHistoryParams,
|
|
42
|
+
GetTransactionHistoryResponse,
|
|
41
43
|
GetTransactionsOrder,
|
|
42
44
|
NFT,
|
|
43
45
|
Network,
|
|
@@ -102,6 +104,7 @@ export enum PortalRequestMethod {
|
|
|
102
104
|
EthSendRawTransaction = 'eth_sendRawTransaction',
|
|
103
105
|
EthSign = 'eth_sign',
|
|
104
106
|
EthSignTransaction = 'eth_signTransaction',
|
|
107
|
+
EthSignUserOperation = 'eth_signUserOperation',
|
|
105
108
|
EthSignTypedDataV3 = 'eth_signTypedData_v3',
|
|
106
109
|
EthSignTypedDataV4 = 'eth_signTypedData_v4',
|
|
107
110
|
PersonalSign = 'personal_sign',
|
|
@@ -250,6 +253,10 @@ export interface IPortalApi {
|
|
|
250
253
|
order?: GetTransactionsOrder,
|
|
251
254
|
traceId?: string,
|
|
252
255
|
): Promise<Transaction[]>
|
|
256
|
+
getTransactionHistory(
|
|
257
|
+
params: GetTransactionHistoryParams,
|
|
258
|
+
traceId?: string,
|
|
259
|
+
): Promise<GetTransactionHistoryResponse>
|
|
253
260
|
prepareClientEject(
|
|
254
261
|
walletId: string,
|
|
255
262
|
backupMethod: BackupMethodsUpperCase,
|
|
@@ -279,6 +286,7 @@ export interface IPortalApi {
|
|
|
279
286
|
| 'ICLOUD'
|
|
280
287
|
| 'PASSKEY'
|
|
281
288
|
| 'PASSWORD'
|
|
289
|
+
| 'FIREBASE'
|
|
282
290
|
| 'UNKNOWN',
|
|
283
291
|
): Promise<void>
|
|
284
292
|
storedClientBackupShareKey(
|
|
@@ -287,6 +295,7 @@ export interface IPortalApi {
|
|
|
287
295
|
| 'CUSTOM'
|
|
288
296
|
| 'GDRIVE'
|
|
289
297
|
| 'ICLOUD'
|
|
298
|
+
| 'FIREBASE'
|
|
290
299
|
| 'PASSKEY'
|
|
291
300
|
| 'PASSWORD'
|
|
292
301
|
| 'UNKNOWN',
|
|
@@ -552,3 +561,10 @@ export class PasswordStorage implements Storage {
|
|
|
552
561
|
})
|
|
553
562
|
}
|
|
554
563
|
}
|
|
564
|
+
export type BackupMethod =
|
|
565
|
+
| 'PASSWORD'
|
|
566
|
+
| 'PASSKEY'
|
|
567
|
+
| 'GDRIVE'
|
|
568
|
+
| 'ICLOUD'
|
|
569
|
+
| 'CUSTOM'
|
|
570
|
+
| 'FIREBASE'
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
type OutgoingRequest,
|
|
4
4
|
type OutgoingRequestData,
|
|
5
5
|
type SignableTransactionData,
|
|
6
|
+
type UserOperation,
|
|
6
7
|
} from '../../types'
|
|
7
8
|
import { convert } from '../currency'
|
|
8
9
|
|
|
@@ -95,6 +96,12 @@ export const parseRequest = async (
|
|
|
95
96
|
data: requestData,
|
|
96
97
|
}
|
|
97
98
|
}
|
|
99
|
+
case 'eth_signUserOperation': {
|
|
100
|
+
return {
|
|
101
|
+
method,
|
|
102
|
+
data: txParam0 as UserOperation,
|
|
103
|
+
}
|
|
104
|
+
}
|
|
98
105
|
case 'eth_sign':
|
|
99
106
|
case 'personal_sign':
|
|
100
107
|
case 'eth_signTypedData_v3':
|
package/src/events/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ enum Events {
|
|
|
17
17
|
GetSigningShareMetadata = 'Get Signing Share Metadata',
|
|
18
18
|
GetSources = 'Get Sources',
|
|
19
19
|
GetTransactions = 'Get Transactions',
|
|
20
|
+
GetTransactionHistory = 'Get Transaction History',
|
|
20
21
|
PrepareClientEject = 'Prepare Client Eject',
|
|
21
22
|
SimulateTransaction = 'Simulate Transaction',
|
|
22
23
|
EvaluateTransaction = 'Evaluate Transaction',
|
package/src/index.ts
CHANGED
|
@@ -91,6 +91,8 @@ export type {
|
|
|
91
91
|
DappOnNetwork,
|
|
92
92
|
DkgData,
|
|
93
93
|
EvaluateTransactionParam,
|
|
94
|
+
GetTransactionHistoryParams,
|
|
95
|
+
GetTransactionHistoryResponse,
|
|
94
96
|
GetTransactionsOrder,
|
|
95
97
|
HttpOptions,
|
|
96
98
|
HttpRequestOptions,
|
|
@@ -105,6 +107,9 @@ export type {
|
|
|
105
107
|
SignableTransactionData,
|
|
106
108
|
SigningRequestArguments,
|
|
107
109
|
SigningResponse,
|
|
110
|
+
SolanaTransactionDetails,
|
|
108
111
|
Transaction,
|
|
112
|
+
TransactionHistoryItem,
|
|
113
|
+
UserOperation,
|
|
109
114
|
Shares,
|
|
110
115
|
} from '../types'
|
package/src/version/version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "version": "4.
|
|
1
|
+
{ "version": "4.7.0" }
|
package/types.d.ts
CHANGED
|
@@ -7,7 +7,10 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import { MpcStatuses } from './src/definitions'
|
|
9
9
|
|
|
10
|
-
export type OutgoingRequestData =
|
|
10
|
+
export type OutgoingRequestData =
|
|
11
|
+
| MessageData
|
|
12
|
+
| SignableTransactionData
|
|
13
|
+
| UserOperation
|
|
11
14
|
|
|
12
15
|
export type ProgressCallback = (status: MpcStatus) => void | Promise<void>
|
|
13
16
|
|
|
@@ -320,6 +323,7 @@ export enum GetTransactionsOrder {
|
|
|
320
323
|
DESC = 'desc',
|
|
321
324
|
}
|
|
322
325
|
|
|
326
|
+
/** @deprecated Use TransactionHistoryItem instead */
|
|
323
327
|
export interface Transaction {
|
|
324
328
|
asset: string
|
|
325
329
|
blockNum: string
|
|
@@ -343,6 +347,198 @@ export interface Transaction {
|
|
|
343
347
|
value: number
|
|
344
348
|
}
|
|
345
349
|
|
|
350
|
+
export type SolanaError =
|
|
351
|
+
| string
|
|
352
|
+
| {
|
|
353
|
+
code?: string | number
|
|
354
|
+
message?: string
|
|
355
|
+
data?: unknown
|
|
356
|
+
}
|
|
357
|
+
| null
|
|
358
|
+
|
|
359
|
+
export interface SolanaTransactionInstruction {
|
|
360
|
+
accounts: number[]
|
|
361
|
+
data: string
|
|
362
|
+
programIdIndex: number
|
|
363
|
+
stackHeight?: number
|
|
364
|
+
parsed?: unknown
|
|
365
|
+
program?: string
|
|
366
|
+
programId?: string
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export interface SolanaTokenBalance {
|
|
370
|
+
accountIndex: number
|
|
371
|
+
mint: string
|
|
372
|
+
owner?: string
|
|
373
|
+
programId?: string
|
|
374
|
+
uiTokenAmount?: {
|
|
375
|
+
amount: string
|
|
376
|
+
decimals: number
|
|
377
|
+
uiAmount: number | null
|
|
378
|
+
uiAmountString: string
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export interface SolanaInnerInstruction {
|
|
383
|
+
index: number
|
|
384
|
+
instructions: Array<{
|
|
385
|
+
accounts: number[]
|
|
386
|
+
data: string
|
|
387
|
+
programIdIndex: number
|
|
388
|
+
parsed?: unknown
|
|
389
|
+
}>
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export interface SolanaReward {
|
|
393
|
+
pubkey: string
|
|
394
|
+
lamports: number
|
|
395
|
+
postBalance: number
|
|
396
|
+
rewardType: string | null
|
|
397
|
+
commission: number | null
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
interface BaseTransactionHistoryItem {
|
|
401
|
+
hash: string
|
|
402
|
+
from: string
|
|
403
|
+
to: string | null
|
|
404
|
+
value: string
|
|
405
|
+
blockNumber: string | null
|
|
406
|
+
blockTimestamp: number | null
|
|
407
|
+
status: string | null
|
|
408
|
+
chainId: string
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface RegularTransaction extends BaseTransactionHistoryItem {
|
|
412
|
+
type: 'transaction'
|
|
413
|
+
asset?: string
|
|
414
|
+
tokenAddress?: string
|
|
415
|
+
tokenDecimals?: number
|
|
416
|
+
userOpHash?: never
|
|
417
|
+
entryPoint?: never
|
|
418
|
+
actualGasCost?: never
|
|
419
|
+
actualGasUsed?: never
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export interface UserOperation {
|
|
423
|
+
sender: string
|
|
424
|
+
nonce: string
|
|
425
|
+
initCode: string
|
|
426
|
+
callData: string
|
|
427
|
+
callGasLimit: string
|
|
428
|
+
verificationGasLimit: string
|
|
429
|
+
preVerificationGas: string
|
|
430
|
+
maxFeePerGas: string
|
|
431
|
+
maxPriorityFeePerGas: string
|
|
432
|
+
paymasterAndData: string
|
|
433
|
+
signature: string
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export interface UserOperationTransaction extends BaseTransactionHistoryItem {
|
|
437
|
+
type: 'userOperation'
|
|
438
|
+
to: null
|
|
439
|
+
value: '0'
|
|
440
|
+
userOpHash: string
|
|
441
|
+
entryPoint: string
|
|
442
|
+
actualGasCost?: string
|
|
443
|
+
actualGasUsed?: string
|
|
444
|
+
asset?: never
|
|
445
|
+
tokenAddress?: never
|
|
446
|
+
tokenDecimals?: never
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export type TransactionHistoryItem =
|
|
450
|
+
| RegularTransaction
|
|
451
|
+
| UserOperationTransaction
|
|
452
|
+
|
|
453
|
+
export interface SolanaTransactionDetails {
|
|
454
|
+
blockTime: number
|
|
455
|
+
error: SolanaError
|
|
456
|
+
signature: string
|
|
457
|
+
status: string
|
|
458
|
+
tokenMint: string | null
|
|
459
|
+
transactionDetails: {
|
|
460
|
+
transaction: {
|
|
461
|
+
message: {
|
|
462
|
+
accountKeys: string[]
|
|
463
|
+
header: {
|
|
464
|
+
numRequiredSignatures: number
|
|
465
|
+
numReadonlySignedAccounts: number
|
|
466
|
+
numReadonlyUnsignedAccounts: number
|
|
467
|
+
}
|
|
468
|
+
instructions: SolanaTransactionInstruction[]
|
|
469
|
+
recentBlockhash: string
|
|
470
|
+
}
|
|
471
|
+
signatures: string[]
|
|
472
|
+
} | null
|
|
473
|
+
signatureDetails: {
|
|
474
|
+
blockTime: number
|
|
475
|
+
confirmationStatus: string
|
|
476
|
+
error: SolanaError
|
|
477
|
+
memo: string | null
|
|
478
|
+
signature: string
|
|
479
|
+
slot: number
|
|
480
|
+
} | null
|
|
481
|
+
metadata: {
|
|
482
|
+
blockTime: number | null
|
|
483
|
+
slot: number | null
|
|
484
|
+
error: SolanaError
|
|
485
|
+
fee: number | null
|
|
486
|
+
innerInstructions?: SolanaInnerInstruction[] | null
|
|
487
|
+
loadedAddresses?: {
|
|
488
|
+
readonly: string[]
|
|
489
|
+
writable: string[]
|
|
490
|
+
} | null
|
|
491
|
+
logMessages: string[] | null
|
|
492
|
+
postBalances: number[] | null
|
|
493
|
+
postTokenBalances?: SolanaTokenBalance[] | null
|
|
494
|
+
preBalances: number[] | null
|
|
495
|
+
preTokenBalances?: SolanaTokenBalance[] | null
|
|
496
|
+
rewards?: SolanaReward[] | null
|
|
497
|
+
status: {
|
|
498
|
+
Ok?: null | unknown
|
|
499
|
+
Err?: unknown
|
|
500
|
+
} | null
|
|
501
|
+
version: 'legacy' | number | null
|
|
502
|
+
} | null
|
|
503
|
+
} | null
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export interface GetTransactionHistoryParams {
|
|
507
|
+
chainId: string
|
|
508
|
+
limit?: number
|
|
509
|
+
offset?: number
|
|
510
|
+
order?: 'asc' | 'desc'
|
|
511
|
+
address?: string
|
|
512
|
+
userOperations?: 'include' | 'only' | 'exclude'
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export interface GetTransactionHistoryMetadata {
|
|
516
|
+
address: string
|
|
517
|
+
chainId: string
|
|
518
|
+
clientId: string
|
|
519
|
+
limit: number
|
|
520
|
+
offset: number
|
|
521
|
+
count: number
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
export interface SolanaTransactionsResponse {
|
|
525
|
+
data: {
|
|
526
|
+
transactions: SolanaTransactionDetails[]
|
|
527
|
+
}
|
|
528
|
+
metadata: GetTransactionHistoryMetadata
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export interface UnifiedTransactionsResponse {
|
|
532
|
+
data: {
|
|
533
|
+
transactions: TransactionHistoryItem[]
|
|
534
|
+
}
|
|
535
|
+
metadata: GetTransactionHistoryMetadata
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export type GetTransactionHistoryResponse =
|
|
539
|
+
| SolanaTransactionsResponse
|
|
540
|
+
| UnifiedTransactionsResponse
|
|
541
|
+
|
|
346
542
|
export interface SimulateTransactionParam {
|
|
347
543
|
to: string
|
|
348
544
|
value?: string
|