@portal-hq/utils 2.0.8 → 2.0.10

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.
@@ -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.8",
3
+ "version": "2.0.10",
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": "b24e07e5135b286db3b287623918c79f0680dc59"
29
+ "gitHead": "9614b8afc13c4cb0a7a6dba7df276de6a690bba9"
30
30
  }
@@ -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,16 +49,19 @@ export interface IPortalApi {
48
49
  getEnabledDapps(): Promise<Dapp[]>
49
50
  getNetworks(): Promise<Network[]>
50
51
  getNFTs(): Promise<NFT[]>
51
- getTransactions(): Promise<Transaction[]>
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
55
61
  ): Promise<SimulatedTransaction>
56
62
  getQuote(apiKey: string, args: QuoteArgs): Promise<QuoteResponse>
57
63
  getSources(apiKey: string): Promise<Record<string, string>>
58
- storedClientSigningShare(options?: {
59
- recoverSigning?: boolean
60
- }): Promise<void>
64
+ storedClientSigningShare(signingSharePairId: string): Promise<void>
61
65
  storedClientBackupShareKey(backupMethod?: string): Promise<void>
62
66
  storedClientBackupShare(
63
67
  success: boolean,
@@ -191,3 +195,32 @@ export abstract class Storage {
191
195
  )
192
196
  }
193
197
  }
198
+
199
+ export class PasswordStorage implements Storage {
200
+ public api?: IPortalApi
201
+
202
+ delete(): Promise<boolean> {
203
+ return new Promise((resolve) => {
204
+ resolve(true)
205
+ })
206
+ }
207
+
208
+ read(): Promise<string> {
209
+ return new Promise((resolve) => {
210
+ resolve('')
211
+ })
212
+ }
213
+
214
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
215
+ write(_privateKey: string): Promise<string> {
216
+ return new Promise((resolve) => {
217
+ resolve('')
218
+ })
219
+ }
220
+
221
+ validateOperations(): Promise<boolean> {
222
+ return new Promise((resolve) => {
223
+ resolve(true)
224
+ })
225
+ }
226
+ }
package/src/index.ts CHANGED
@@ -50,6 +50,7 @@ export {
50
50
  type DappImage,
51
51
  type DappOnNetwork,
52
52
  type DkgData,
53
+ type GetTransactionsOrder,
53
54
  type HttpOptions,
54
55
  type HttpRequestOptions,
55
56
  type HttpRequesterOptions,
package/types.d.ts CHANGED
@@ -57,23 +57,16 @@ export interface DappImage {
57
57
  }
58
58
 
59
59
  export interface DkgData {
60
- share: string
61
- ssid: string
62
- pubkey: Pubkey
63
- partialPubkey: {
64
- [key: MpcMember]: Pubkey
65
- }
66
- allY: {
67
- [key: MpcMember]: Pubkey
68
- }
60
+ allY: { [key: MpcMember]: Pubkey }
61
+ bks: { [key: MpcMember]: Bk }
69
62
  p: string
63
+ partialPubkey: { [key: MpcMember]: Pubkey }
64
+ pederson: { [key: MpcMember]: PedersonParams }
65
+ pubkey: Pubkey
70
66
  q: string
71
- pederson: {
72
- [key: MpcMember]: PedersonParams
73
- }
74
- bks: {
75
- [key: MpcMember]: Bk
76
- }
67
+ share: string
68
+ signingSharePairId?: string
69
+ ssid: string
77
70
  }
78
71
 
79
72
  export interface PedersonParams {
@@ -154,6 +147,7 @@ export interface QuoteArgs {
154
147
  }
155
148
 
156
149
  export interface QuoteResponse {
150
+ allowanceTarget: string
157
151
  cost: string
158
152
  transaction: Eip1559 | LegacyTx
159
153
  }
@@ -207,14 +201,23 @@ export interface NFT {
207
201
  contractMetadata: ContractMetadata
208
202
  }
209
203
 
204
+ export enum GetTransactionsOrder {
205
+ ASC = 'asc',
206
+ DESC = 'desc',
207
+ }
208
+
210
209
  export interface Transaction {
211
210
  asset: string
212
211
  blockNum: string
213
212
  category: string
213
+ chainId: number
214
214
  erc1155Metadata: null | string
215
215
  erc721TokenId: null | string
216
216
  from: string
217
217
  hash: string
218
+ metadata: {
219
+ blockTimestamp: string
220
+ }
218
221
  rawContract: {
219
222
  address: string
220
223
  decimal: string
@@ -315,3 +318,11 @@ export interface OpenSeaMetadata {
315
318
  twitterUsername?: string
316
319
  discordUrl?: string
317
320
  }
321
+
322
+ export interface BackupConfigs {
323
+ passwordStorage?: PasswordStorageConfig
324
+ }
325
+
326
+ export interface PasswordStorageConfig {
327
+ password: string
328
+ }