@portal-hq/provider 0.2.0-beta11 → 0.2.0-beta2

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.
@@ -30,7 +30,7 @@ const signerMethods = [
30
30
  class Provider {
31
31
  constructor({
32
32
  // Required options
33
- apiKey, chainId, keychain,
33
+ apiKey, chainId,
34
34
  // Optional options
35
35
  apiUrl = 'api.portalhq.io', autoApprove = false, enableMpc = true, mpcUrl = 'mpc.portalhq.io', gatewayConfig = {}, }) {
36
36
  // Handle required fields
@@ -50,7 +50,6 @@ class Provider {
50
50
  this.chainId = chainId;
51
51
  this.events = {};
52
52
  this.isMPC = enableMpc;
53
- this.keychain = keychain;
54
53
  this.log = console;
55
54
  this.mpcUrl = mpcUrl;
56
55
  this.portal = new requesters_1.HttpRequester({
@@ -65,7 +64,6 @@ class Provider {
65
64
  // If MPC is enabled, initialize an MpcSigner
66
65
  this.signer = new signers_1.MpcSigner({
67
66
  mpcUrl: this.mpcUrl,
68
- keychain: this.keychain,
69
67
  });
70
68
  }
71
69
  else {
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const keychain_1 = require("@portal-hq/keychain");
12
+ const core_1 = require("@portal-hq/core");
13
13
  const utils_1 = require("@portal-hq/utils");
14
14
  class HttpSigner {
15
15
  constructor(opts) {
@@ -19,7 +19,7 @@ class HttpSigner {
19
19
  option: 'portal',
20
20
  });
21
21
  }
22
- this.keychain = new keychain_1.Keychain();
22
+ this.keychain = new core_1.Keychain();
23
23
  this.portal = opts.portal;
24
24
  }
25
25
  sign(message, provider) {
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const react_native_1 = require("react-native");
13
+ const core_1 = require("@portal-hq/core");
13
14
  const utils_1 = require("@portal-hq/utils");
14
15
  class MpcSigner {
15
16
  constructor(opts) {
@@ -29,12 +30,12 @@ class MpcSigner {
29
30
  }
30
31
  return params;
31
32
  };
32
- this.keychain = opts.keychain;
33
33
  this.mpc = react_native_1.NativeModules.PortalMobileMpc;
34
34
  this.mpcUrl = opts.mpcUrl;
35
35
  if (!this.mpc) {
36
36
  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.`);
37
37
  }
38
+ this.keychain = new core_1.Keychain();
38
39
  }
39
40
  get address() {
40
41
  return (() => __awaiter(this, void 0, void 0, function* () {
@@ -28,7 +28,7 @@ const signerMethods = [
28
28
  class Provider {
29
29
  constructor({
30
30
  // Required options
31
- apiKey, chainId, keychain,
31
+ apiKey, chainId,
32
32
  // Optional options
33
33
  apiUrl = 'api.portalhq.io', autoApprove = false, enableMpc = true, mpcUrl = 'mpc.portalhq.io', gatewayConfig = {}, }) {
34
34
  // Handle required fields
@@ -48,7 +48,6 @@ class Provider {
48
48
  this.chainId = chainId;
49
49
  this.events = {};
50
50
  this.isMPC = enableMpc;
51
- this.keychain = keychain;
52
51
  this.log = console;
53
52
  this.mpcUrl = mpcUrl;
54
53
  this.portal = new HttpRequester({
@@ -63,7 +62,6 @@ class Provider {
63
62
  // If MPC is enabled, initialize an MpcSigner
64
63
  this.signer = new MpcSigner({
65
64
  mpcUrl: this.mpcUrl,
66
- keychain: this.keychain,
67
65
  });
68
66
  }
69
67
  else {
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { Keychain } from '@portal-hq/keychain';
10
+ import { Keychain } from '@portal-hq/core';
11
11
  import { MissingOptionError } from '@portal-hq/utils';
12
12
  class HttpSigner {
13
13
  constructor(opts) {
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { NativeModules } from 'react-native';
11
+ import { Keychain } from '@portal-hq/core';
11
12
  import { MpcSigningError } from '@portal-hq/utils';
12
13
  class MpcSigner {
13
14
  constructor(opts) {
@@ -27,12 +28,12 @@ class MpcSigner {
27
28
  }
28
29
  return params;
29
30
  };
30
- this.keychain = opts.keychain;
31
31
  this.mpc = NativeModules.PortalMobileMpc;
32
32
  this.mpcUrl = opts.mpcUrl;
33
33
  if (!this.mpc) {
34
34
  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.`);
35
35
  }
36
+ this.keychain = new Keychain();
36
37
  }
37
38
  get address() {
38
39
  return (() => __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portal-hq/provider",
3
- "version": "0.2.0-beta11",
3
+ "version": "0.2.0-beta2",
4
4
  "license": "MIT",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -17,7 +17,8 @@
17
17
  "prepare:esm": "tsc --outDir lib/esm --module es2015 --target es2015"
18
18
  },
19
19
  "dependencies": {
20
- "@portal-hq/utils": "^0.2.0-beta11"
20
+ "@portal-hq/core": "^0.2.0-beta1",
21
+ "@portal-hq/utils": "^0.2.0-beta1"
21
22
  },
22
23
  "devDependencies": {
23
24
  "typescript": "^4.8.4"
@@ -2,7 +2,6 @@ import {
2
2
  InvalidApiKeyError,
3
3
  InvalidChainIdError,
4
4
  InvalidGatewayConfigError,
5
- KeychainAdapter,
6
5
  ProviderRpcError,
7
6
  RpcErrorCodes,
8
7
  } from '@portal-hq/utils'
@@ -47,7 +46,6 @@ class Provider {
47
46
  private apiUrl: string
48
47
  private autoApprove?: boolean
49
48
  private events: Record<string, RegisteredEventHandler[]>
50
- private keychain: KeychainAdapter
51
49
  private log: Console
52
50
  private gatewayConfig: GatewayLike
53
51
  private rpc: HttpRequester
@@ -58,7 +56,6 @@ class Provider {
58
56
  // Required options
59
57
  apiKey,
60
58
  chainId,
61
- keychain,
62
59
 
63
60
  // Optional options
64
61
  apiUrl = 'api.portalhq.io',
@@ -85,7 +82,6 @@ class Provider {
85
82
  this.chainId = chainId
86
83
  this.events = {}
87
84
  this.isMPC = enableMpc
88
- this.keychain = keychain
89
85
  this.log = console
90
86
  this.mpcUrl = mpcUrl
91
87
  this.portal = new HttpRequester({
@@ -103,7 +99,6 @@ class Provider {
103
99
  // If MPC is enabled, initialize an MpcSigner
104
100
  this.signer = new MpcSigner({
105
101
  mpcUrl: this.mpcUrl,
106
- keychain: this.keychain,
107
102
  })
108
103
  } else {
109
104
  // If MPC is disabled, initialize an HttpSigner, talking to whatever httpHost was provided
@@ -1,4 +1,4 @@
1
- import { Keychain } from '@portal-hq/keychain'
1
+ import { Keychain } from '@portal-hq/core'
2
2
  import { MissingOptionError } from '@portal-hq/utils'
3
3
 
4
4
  import {
@@ -1,5 +1,6 @@
1
1
  import { NativeModules } from 'react-native'
2
- import { KeychainAdapter, MpcSigningError } from '@portal-hq/utils'
2
+ import { Keychain } from '@portal-hq/core'
3
+ import { MpcSigningError } from '@portal-hq/utils'
3
4
 
4
5
  import { Provider } from '../index'
5
6
  import Signer from './abstract'
@@ -13,12 +14,11 @@ import {
13
14
 
14
15
  class MpcSigner implements Signer {
15
16
  public _address: string
16
- private keychain: KeychainAdapter
17
+ private keychain: Keychain
17
18
  private mpc: PortalMobileMpc
18
19
  private mpcUrl: string
19
20
 
20
21
  constructor(opts: MpcSignerOptions) {
21
- this.keychain = opts.keychain
22
22
  this.mpc = NativeModules.PortalMobileMpc
23
23
  this.mpcUrl = opts.mpcUrl
24
24
 
@@ -27,6 +27,8 @@ class MpcSigner implements Signer {
27
27
  `[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.`,
28
28
  )
29
29
  }
30
+
31
+ this.keychain = new Keychain()
30
32
  }
31
33
 
32
34
  public get address() {
package/types.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  // Types
2
2
 
3
- import { KeychainAdapter } from '@portal-hq/utils'
4
-
5
3
  export type EventHandler = (data: any) => void
6
4
 
7
5
  export type GatewayLike = GatewayConfig | string
@@ -23,7 +21,6 @@ export interface HttpSignerOptions extends SignerOptions {
23
21
  }
24
22
 
25
23
  export interface MpcSignerOptions extends SignerOptions {
26
- keychain: KeychainAdapter
27
24
  mpcUrl: string
28
25
  }
29
26
 
@@ -50,7 +47,6 @@ export interface ProviderOptions {
50
47
  // Required options
51
48
  apiKey: string
52
49
  chainId: number
53
- keychain: KeychainAdapter
54
50
  gatewayConfig: GatewayLike
55
51
 
56
52
  // Optional options