@portal-hq/utils 2.0.8 → 2.0.9
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 +25 -1
- package/lib/esm/definitions/index.js +23 -0
- package/package.json +2 -2
- package/src/definitions/index.ts +36 -1
- package/src/index.ts +1 -0
- package/types.d.ts +18 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Storage = exports.MpcStatuses = exports.KeychainAdapter = void 0;
|
|
3
|
+
exports.PasswordStorage = exports.Storage = exports.MpcStatuses = exports.KeychainAdapter = void 0;
|
|
4
4
|
class KeychainAdapter {
|
|
5
5
|
deleteAddress() {
|
|
6
6
|
throw new Error('[Portal] KeychainAdapter method deleteAddress cannot be called directly. Please extend KeychainAdapter.');
|
|
@@ -56,3 +56,27 @@ class Storage {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
exports.Storage = Storage;
|
|
59
|
+
class PasswordStorage {
|
|
60
|
+
delete() {
|
|
61
|
+
return new Promise((resolve) => {
|
|
62
|
+
resolve(true);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
read() {
|
|
66
|
+
return new Promise((resolve) => {
|
|
67
|
+
resolve('');
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
71
|
+
write(_privateKey) {
|
|
72
|
+
return new Promise((resolve) => {
|
|
73
|
+
resolve('');
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
validateOperations() {
|
|
77
|
+
return new Promise((resolve) => {
|
|
78
|
+
resolve(true);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.PasswordStorage = PasswordStorage;
|
|
@@ -51,3 +51,26 @@ export class Storage {
|
|
|
51
51
|
throw new Error(`[Portal] Storage method validateOperations() cannot be called directly. Please extend Storage.`);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
export class PasswordStorage {
|
|
55
|
+
delete() {
|
|
56
|
+
return new Promise((resolve) => {
|
|
57
|
+
resolve(true);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
read() {
|
|
61
|
+
return new Promise((resolve) => {
|
|
62
|
+
resolve('');
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
66
|
+
write(_privateKey) {
|
|
67
|
+
return new Promise((resolve) => {
|
|
68
|
+
resolve('');
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
validateOperations() {
|
|
72
|
+
return new Promise((resolve) => {
|
|
73
|
+
resolve(true);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portal-hq/utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
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": "50934ab37ba9e44a588d26a68214ca44bde44740"
|
|
30
30
|
}
|
package/src/definitions/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
ClientWithCustodianData,
|
|
5
5
|
Dapp,
|
|
6
6
|
DkgData,
|
|
7
|
+
GetTransactionsOrder,
|
|
7
8
|
NFT,
|
|
8
9
|
Network,
|
|
9
10
|
ProgressCallback,
|
|
@@ -48,7 +49,12 @@ export interface IPortalApi {
|
|
|
48
49
|
getEnabledDapps(): Promise<Dapp[]>
|
|
49
50
|
getNetworks(): Promise<Network[]>
|
|
50
51
|
getNFTs(): Promise<NFT[]>
|
|
51
|
-
getTransactions(
|
|
52
|
+
getTransactions(
|
|
53
|
+
limit?: number,
|
|
54
|
+
offset?: number,
|
|
55
|
+
order?: GetTransactionsOrder,
|
|
56
|
+
chainId?: number
|
|
57
|
+
): Promise<Transaction[]>
|
|
52
58
|
getBalances(): Promise<Balance[]>
|
|
53
59
|
simulateTransaction(
|
|
54
60
|
params: SimulateTransactionParam
|
|
@@ -191,3 +197,32 @@ export abstract class Storage {
|
|
|
191
197
|
)
|
|
192
198
|
}
|
|
193
199
|
}
|
|
200
|
+
|
|
201
|
+
export class PasswordStorage implements Storage {
|
|
202
|
+
public api?: IPortalApi
|
|
203
|
+
|
|
204
|
+
delete(): Promise<boolean> {
|
|
205
|
+
return new Promise((resolve) => {
|
|
206
|
+
resolve(true)
|
|
207
|
+
})
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
read(): Promise<string> {
|
|
211
|
+
return new Promise((resolve) => {
|
|
212
|
+
resolve('')
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
217
|
+
write(_privateKey: string): Promise<string> {
|
|
218
|
+
return new Promise((resolve) => {
|
|
219
|
+
resolve('')
|
|
220
|
+
})
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
validateOperations(): Promise<boolean> {
|
|
224
|
+
return new Promise((resolve) => {
|
|
225
|
+
resolve(true)
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
}
|
package/src/index.ts
CHANGED
package/types.d.ts
CHANGED
|
@@ -154,6 +154,7 @@ export interface QuoteArgs {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
export interface QuoteResponse {
|
|
157
|
+
allowanceTarget: string
|
|
157
158
|
cost: string
|
|
158
159
|
transaction: Eip1559 | LegacyTx
|
|
159
160
|
}
|
|
@@ -207,14 +208,23 @@ export interface NFT {
|
|
|
207
208
|
contractMetadata: ContractMetadata
|
|
208
209
|
}
|
|
209
210
|
|
|
211
|
+
export enum GetTransactionsOrder {
|
|
212
|
+
ASC = 'asc',
|
|
213
|
+
DESC = 'desc',
|
|
214
|
+
}
|
|
215
|
+
|
|
210
216
|
export interface Transaction {
|
|
211
217
|
asset: string
|
|
212
218
|
blockNum: string
|
|
213
219
|
category: string
|
|
220
|
+
chainId: number
|
|
214
221
|
erc1155Metadata: null | string
|
|
215
222
|
erc721TokenId: null | string
|
|
216
223
|
from: string
|
|
217
224
|
hash: string
|
|
225
|
+
metadata: {
|
|
226
|
+
blockTimestamp: string
|
|
227
|
+
}
|
|
218
228
|
rawContract: {
|
|
219
229
|
address: string
|
|
220
230
|
decimal: string
|
|
@@ -315,3 +325,11 @@ export interface OpenSeaMetadata {
|
|
|
315
325
|
twitterUsername?: string
|
|
316
326
|
discordUrl?: string
|
|
317
327
|
}
|
|
328
|
+
|
|
329
|
+
export interface BackupConfigs {
|
|
330
|
+
passwordStorage?: PasswordStorageConfig
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface PasswordStorageConfig {
|
|
334
|
+
password: string
|
|
335
|
+
}
|