@portal-hq/provider 2.1.1 → 3.0.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.
@@ -38,7 +38,7 @@ class Provider {
38
38
  // Required
39
39
  apiKey, chainId, keychain, gatewayConfig,
40
40
  // Optional
41
- isSimulator = false, autoApprove = false, apiHost = 'api.portalhq.io', mpcHost = 'mpc.portalhq.io', version = 'v5', featureFlags = { optimized: false }, }) {
41
+ isSimulator = false, autoApprove = false, apiHost = 'api.portalhq.io', mpcHost = 'mpc.portalhq.io', version = 'v6', featureFlags = { optimized: false }, }) {
42
42
  // Handle required fields
43
43
  if (!apiKey || apiKey.length === 0) {
44
44
  throw new utils_1.InvalidApiKeyError();
@@ -18,8 +18,8 @@ class MpcSigner {
18
18
  get signingShare() {
19
19
  return this.keychain.getDkgResult(this.isSimulator);
20
20
  }
21
- constructor({ keychain, isSimulator = false, mpcHost = 'mpc.portalhq.io', version = 'v5', featureFlags = { optimized: false }, }) {
22
- this.version = 'v5';
21
+ constructor({ keychain, isSimulator = false, mpcHost = 'mpc.portalhq.io', version = 'v6', featureFlags = { optimized: false }, }) {
22
+ this.version = 'v6';
23
23
  this.buildParams = (method, txParams) => {
24
24
  let params = txParams;
25
25
  switch (method) {
@@ -36,7 +36,7 @@ class Provider {
36
36
  // Required
37
37
  apiKey, chainId, keychain, gatewayConfig,
38
38
  // Optional
39
- isSimulator = false, autoApprove = false, apiHost = 'api.portalhq.io', mpcHost = 'mpc.portalhq.io', version = 'v5', featureFlags = { optimized: false }, }) {
39
+ isSimulator = false, autoApprove = false, apiHost = 'api.portalhq.io', mpcHost = 'mpc.portalhq.io', version = 'v6', featureFlags = { optimized: false }, }) {
40
40
  // Handle required fields
41
41
  if (!apiKey || apiKey.length === 0) {
42
42
  throw new InvalidApiKeyError();
@@ -16,8 +16,8 @@ class MpcSigner {
16
16
  get signingShare() {
17
17
  return this.keychain.getDkgResult(this.isSimulator);
18
18
  }
19
- constructor({ keychain, isSimulator = false, mpcHost = 'mpc.portalhq.io', version = 'v5', featureFlags = { optimized: false }, }) {
20
- this.version = 'v5';
19
+ constructor({ keychain, isSimulator = false, mpcHost = 'mpc.portalhq.io', version = 'v6', featureFlags = { optimized: false }, }) {
20
+ this.version = 'v6';
21
21
  this.buildParams = (method, txParams) => {
22
22
  let params = txParams;
23
23
  switch (method) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portal-hq/provider",
3
- "version": "2.1.1",
3
+ "version": "3.0.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/esm/index",
@@ -19,8 +19,8 @@
19
19
  "test": "jest"
20
20
  },
21
21
  "dependencies": {
22
- "@portal-hq/connect": "^2.1.1",
23
- "@portal-hq/utils": "^2.1.1"
22
+ "@portal-hq/connect": "^3.0.0",
23
+ "@portal-hq/utils": "^3.0.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@babel/preset-typescript": "^7.18.6",
@@ -30,5 +30,5 @@
30
30
  "ts-jest": "^29.0.3",
31
31
  "typescript": "^4.8.4"
32
32
  },
33
- "gitHead": "d21ddfb4554d3700f529157f71b8303de66a7882"
33
+ "gitHead": "1f49bc43f0778a40089e1d736fbb63eb952b6001"
34
34
  }
@@ -74,7 +74,7 @@ class Provider implements IPortalProvider {
74
74
  autoApprove = false,
75
75
  apiHost = 'api.portalhq.io',
76
76
  mpcHost = 'mpc.portalhq.io',
77
- version = 'v5',
77
+ version = 'v6',
78
78
  featureFlags = { optimized: false },
79
79
  }: ProviderOptions) {
80
80
  // Handle required fields
@@ -21,7 +21,7 @@ class MpcSigner implements Signer {
21
21
  private keychain: KeychainAdapter
22
22
  private mpc: PortalMobileMpc
23
23
  private mpcHost: string // should we add a default here mpc.portalhq.io
24
- private version = 'v5'
24
+ private version = 'v6'
25
25
  private featureFlags: FeatureFlags
26
26
 
27
27
  private get address(): Promise<string | undefined> {
@@ -36,7 +36,7 @@ class MpcSigner implements Signer {
36
36
  keychain,
37
37
  isSimulator = false,
38
38
  mpcHost = 'mpc.portalhq.io',
39
- version = 'v5',
39
+ version = 'v6',
40
40
  featureFlags = { optimized: false },
41
41
  }: MpcSignerOptions) {
42
42
  this.isSimulator = isSimulator
@@ -48,14 +48,14 @@ class MpcSigner implements Signer {
48
48
 
49
49
  if (!this.mpc) {
50
50
  throw new Error(
51
- `[Portal.Provider.MpcSigner] The MPC module could not be found by the signer. This is usually an issue with React Native linking. Please verify that the 'PortalReactNative' module is properly linked to this project.`
51
+ `[Portal.Provider.MpcSigner] The MPC module could not be found by the signer. This is usually an issue with React Native linking. Please verify that the 'PortalReactNative' module is properly linked to this project.`,
52
52
  )
53
53
  }
54
54
  }
55
55
 
56
56
  public async sign(
57
57
  message: SigningRequestArguments,
58
- provider: IPortalProvider
58
+ provider: IPortalProvider,
59
59
  ): Promise<any> {
60
60
  const address = await this.address
61
61
  const apiKey = provider.apiKey
@@ -87,7 +87,7 @@ class MpcSigner implements Signer {
87
87
  JSON.stringify(this.buildParams(method, params)),
88
88
  provider.gatewayUrl,
89
89
  provider.chainId.toString(),
90
- stringifiedMetadata
90
+ stringifiedMetadata,
91
91
  )
92
92
 
93
93
  const { data, error } = JSON.parse(String(result)) as SigningResponse
package/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // Types
2
2
 
3
3
  import PortalConnect from '@portal-hq/connect'
4
+ import { BackupMethods } from '@portal-hq/core'
4
5
  import { KeychainAdapter, type PortalError } from '@portal-hq/utils'
5
6
 
6
7
  export type EventHandler = (data: any) => void
@@ -26,6 +27,13 @@ export interface MpcSignerOptions extends SignerOptions {
26
27
  }
27
28
 
28
29
  export interface PortalMobileMpcMetadata {
30
+ backupMethod?:
31
+ | 'CUSTOM'
32
+ | 'GDRIVE'
33
+ | 'ICLOUD'
34
+ | 'PASSKEY'
35
+ | 'PASSWORD'
36
+ | 'UNKNOWN'
29
37
  clientPlatform: string
30
38
  mpcServerVersion: string
31
39
  optimized: boolean
@@ -35,14 +43,14 @@ export interface PortalMobileMpc {
35
43
  generate: (
36
44
  clientApiKey: string,
37
45
  mpcApiUrl: string,
38
- metadata: string
46
+ metadata: string,
39
47
  ) => Promise<string>
40
48
  rotate: (
41
49
  clientApiKey: string,
42
50
  mpcApiUrl: string,
43
51
  isSim: boolean,
44
52
  dkgResult?: string,
45
- metadata: string
53
+ metadata: string,
46
54
  ) => Promise<string>
47
55
  sign: (
48
56
  clientApiKey: string,
@@ -52,7 +60,7 @@ export interface PortalMobileMpc {
52
60
  requestId: string,
53
61
  mpcUrl: string,
54
62
  chainId: string,
55
- metadata: string
63
+ metadata: string,
56
64
  ) => Promise<string>
57
65
  }
58
66