@portal-hq/provider 2.0.9 → 2.0.11

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.
@@ -28,11 +28,17 @@ const signerMethods = [
28
28
  'personal_sign',
29
29
  ];
30
30
  class Provider {
31
+ get address() {
32
+ return this.keychain.getAddress(this.isSimulator);
33
+ }
34
+ get gatewayUrl() {
35
+ return this.getGatewayUrl();
36
+ }
31
37
  constructor({
32
38
  // Required
33
39
  apiKey, chainId, keychain, gatewayConfig,
34
40
  // Optional
35
- isSimulator = false, autoApprove = false, apiHost = 'api.portalhq.io', mpcHost = 'mpc.portalhq.io', version = 'v4', featureFlags = { optimized: false }, }) {
41
+ isSimulator = false, autoApprove = false, apiHost = 'api.portalhq.io', mpcHost = 'mpc.portalhq.io', version = 'v5', featureFlags = { optimized: false }, }) {
36
42
  // Handle required fields
37
43
  if (!apiKey || apiKey.length === 0) {
38
44
  throw new utils_1.InvalidApiKeyError();
@@ -71,12 +77,6 @@ class Provider {
71
77
  featureFlags,
72
78
  });
73
79
  }
74
- get address() {
75
- return this.keychain.getAddress(this.isSimulator);
76
- }
77
- get gatewayUrl() {
78
- return this.getGatewayUrl();
79
- }
80
80
  /**
81
81
  * Invokes all registered event handlers with the data provided
82
82
  * - If any `once` handlers exist, they are removed after all handlers are invoked
@@ -12,8 +12,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const react_native_1 = require("react-native");
13
13
  const utils_1 = require("@portal-hq/utils");
14
14
  class MpcSigner {
15
- constructor({ keychain, isSimulator = false, mpcHost = 'mpc.portalhq.io', version = 'v4', featureFlags = { optimized: false }, }) {
16
- this.version = 'v4';
15
+ get address() {
16
+ return this.keychain.getAddress(this.isSimulator);
17
+ }
18
+ get signingShare() {
19
+ return this.keychain.getDkgResult(this.isSimulator);
20
+ }
21
+ constructor({ keychain, isSimulator = false, mpcHost = 'mpc.portalhq.io', version = 'v5', featureFlags = { optimized: false }, }) {
22
+ this.version = 'v5';
17
23
  this.buildParams = (method, txParams) => {
18
24
  let params = txParams;
19
25
  switch (method) {
@@ -42,12 +48,6 @@ class MpcSigner {
42
48
  throw new Error(`[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.`);
43
49
  }
44
50
  }
45
- get address() {
46
- return this.keychain.getAddress(this.isSimulator);
47
- }
48
- get signingShare() {
49
- return this.keychain.getDkgResult(this.isSimulator);
50
- }
51
51
  sign(message, provider) {
52
52
  return __awaiter(this, void 0, void 0, function* () {
53
53
  const address = yield this.address;
@@ -26,11 +26,17 @@ const signerMethods = [
26
26
  'personal_sign',
27
27
  ];
28
28
  class Provider {
29
+ get address() {
30
+ return this.keychain.getAddress(this.isSimulator);
31
+ }
32
+ get gatewayUrl() {
33
+ return this.getGatewayUrl();
34
+ }
29
35
  constructor({
30
36
  // Required
31
37
  apiKey, chainId, keychain, gatewayConfig,
32
38
  // Optional
33
- isSimulator = false, autoApprove = false, apiHost = 'api.portalhq.io', mpcHost = 'mpc.portalhq.io', version = 'v4', featureFlags = { optimized: false }, }) {
39
+ isSimulator = false, autoApprove = false, apiHost = 'api.portalhq.io', mpcHost = 'mpc.portalhq.io', version = 'v5', featureFlags = { optimized: false }, }) {
34
40
  // Handle required fields
35
41
  if (!apiKey || apiKey.length === 0) {
36
42
  throw new InvalidApiKeyError();
@@ -69,12 +75,6 @@ class Provider {
69
75
  featureFlags,
70
76
  });
71
77
  }
72
- get address() {
73
- return this.keychain.getAddress(this.isSimulator);
74
- }
75
- get gatewayUrl() {
76
- return this.getGatewayUrl();
77
- }
78
78
  /**
79
79
  * Invokes all registered event handlers with the data provided
80
80
  * - If any `once` handlers exist, they are removed after all handlers are invoked
@@ -10,8 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { NativeModules } from 'react-native';
11
11
  import { PortalMpcError, } from '@portal-hq/utils';
12
12
  class MpcSigner {
13
- constructor({ keychain, isSimulator = false, mpcHost = 'mpc.portalhq.io', version = 'v4', featureFlags = { optimized: false }, }) {
14
- this.version = 'v4';
13
+ get address() {
14
+ return this.keychain.getAddress(this.isSimulator);
15
+ }
16
+ get signingShare() {
17
+ return this.keychain.getDkgResult(this.isSimulator);
18
+ }
19
+ constructor({ keychain, isSimulator = false, mpcHost = 'mpc.portalhq.io', version = 'v5', featureFlags = { optimized: false }, }) {
20
+ this.version = 'v5';
15
21
  this.buildParams = (method, txParams) => {
16
22
  let params = txParams;
17
23
  switch (method) {
@@ -40,12 +46,6 @@ class MpcSigner {
40
46
  throw new Error(`[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.`);
41
47
  }
42
48
  }
43
- get address() {
44
- return this.keychain.getAddress(this.isSimulator);
45
- }
46
- get signingShare() {
47
- return this.keychain.getDkgResult(this.isSimulator);
48
- }
49
49
  sign(message, provider) {
50
50
  return __awaiter(this, void 0, void 0, function* () {
51
51
  const address = yield this.address;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portal-hq/provider",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
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.0.9",
23
- "@portal-hq/utils": "^2.0.9"
22
+ "@portal-hq/connect": "^2.0.11",
23
+ "@portal-hq/utils": "^2.0.11"
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": "50934ab37ba9e44a588d26a68214ca44bde44740"
33
+ "gitHead": "4d2140adec1afe2a882f825bbf958434ab7d180b"
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 = 'v4',
77
+ version = 'v5',
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 = 'v4'
24
+ private version = 'v5'
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 = 'v4',
39
+ version = 'v5',
40
40
  featureFlags = { optimized: false },
41
41
  }: MpcSignerOptions) {
42
42
  this.isSimulator = isSimulator