@portal-hq/provider 0.2.7 → 0.2.8

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.
@@ -71,6 +71,7 @@ class Provider {
71
71
  else {
72
72
  // If MPC is disabled, initialize an HttpSigner, talking to whatever httpHost was provided
73
73
  this.signer = new signers_1.HttpSigner({
74
+ keychain: this.keychain,
74
75
  portal: this.portal,
75
76
  });
76
77
  }
@@ -9,7 +9,6 @@ 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");
13
12
  const utils_1 = require("@portal-hq/utils");
14
13
  class HttpSigner {
15
14
  constructor(opts) {
@@ -19,13 +18,12 @@ class HttpSigner {
19
18
  option: 'portal',
20
19
  });
21
20
  }
22
- this.keychain = new keychain_1.Keychain();
21
+ this.keychain = opts.keychain;
23
22
  this.portal = opts.portal;
24
23
  }
25
24
  sign(message, provider) {
26
25
  return __awaiter(this, void 0, void 0, function* () {
27
26
  const address = yield this.keychain.getAddress();
28
- const arrayMethods = ['personal_sign'];
29
27
  const { chainId, method, params } = message;
30
28
  switch (method) {
31
29
  case 'eth_requestAccounts':
@@ -69,6 +69,7 @@ class Provider {
69
69
  else {
70
70
  // If MPC is disabled, initialize an HttpSigner, talking to whatever httpHost was provided
71
71
  this.signer = new HttpSigner({
72
+ keychain: this.keychain,
72
73
  portal: this.portal,
73
74
  });
74
75
  }
@@ -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 { HttpRequest } from '@portal-hq/utils';
10
+ import { HttpRequest, } from '@portal-hq/utils';
11
11
  class HttpRequester {
12
12
  constructor({ baseUrl }) {
13
13
  this.baseUrl = baseUrl.startsWith('https://')
@@ -7,7 +7,6 @@ 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';
11
10
  import { MissingOptionError } from '@portal-hq/utils';
12
11
  class HttpSigner {
13
12
  constructor(opts) {
@@ -17,13 +16,12 @@ class HttpSigner {
17
16
  option: 'portal',
18
17
  });
19
18
  }
20
- this.keychain = new Keychain();
19
+ this.keychain = opts.keychain;
21
20
  this.portal = opts.portal;
22
21
  }
23
22
  sign(message, provider) {
24
23
  return __awaiter(this, void 0, void 0, function* () {
25
24
  const address = yield this.keychain.getAddress();
26
- const arrayMethods = ['personal_sign'];
27
25
  const { chainId, method, params } = message;
28
26
  switch (method) {
29
27
  case 'eth_requestAccounts':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portal-hq/provider",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "license": "MIT",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/esm/index",
@@ -17,7 +17,7 @@
17
17
  "prepare:esm": "tsc --outDir lib/esm --module es2015 --target es2015"
18
18
  },
19
19
  "dependencies": {
20
- "@portal-hq/utils": "^0.2.7"
20
+ "@portal-hq/utils": "^0.2.8"
21
21
  },
22
22
  "devDependencies": {
23
23
  "typescript": "^4.8.4"
@@ -108,6 +108,7 @@ class Provider {
108
108
  } else {
109
109
  // If MPC is disabled, initialize an HttpSigner, talking to whatever httpHost was provided
110
110
  this.signer = new HttpSigner({
111
+ keychain: this.keychain,
111
112
  portal: this.portal,
112
113
  })
113
114
  }
@@ -1,9 +1,9 @@
1
- import { HttpRequest } from '@portal-hq/utils'
2
1
  import {
2
+ HttpRequest,
3
3
  type HttpRequestOptions,
4
4
  type HttpOptions,
5
5
  type HttpRequesterOptions,
6
- } from '@portal-hq/utils/types'
6
+ } from '@portal-hq/utils'
7
7
 
8
8
  class HttpRequester {
9
9
  private baseUrl: string
@@ -1,5 +1,4 @@
1
- import { Keychain } from '@portal-hq/keychain'
2
- import { MissingOptionError } from '@portal-hq/utils'
1
+ import { KeychainAdapter, MissingOptionError } from '@portal-hq/utils'
3
2
 
4
3
  import {
5
4
  type HttpSignerOptions,
@@ -13,7 +12,7 @@ import HttpRequester from '../requesters/http'
13
12
 
14
13
  class HttpSigner implements Signer {
15
14
  private portal: HttpRequester
16
- private keychain: Keychain
15
+ private keychain: KeychainAdapter
17
16
 
18
17
  constructor(opts: HttpSignerOptions) {
19
18
  if (!opts.portal) {
@@ -23,7 +22,7 @@ class HttpSigner implements Signer {
23
22
  })
24
23
  }
25
24
 
26
- this.keychain = new Keychain()
25
+ this.keychain = opts.keychain
27
26
  this.portal = opts.portal
28
27
  }
29
28
 
@@ -32,7 +31,6 @@ class HttpSigner implements Signer {
32
31
  provider: Provider,
33
32
  ): Promise<any> {
34
33
  const address = await this.keychain.getAddress()
35
- const arrayMethods = ['personal_sign']
36
34
  const { chainId, method, params } = message
37
35
 
38
36
  switch (method) {
package/types.d.ts CHANGED
@@ -19,6 +19,7 @@ export interface HttpRequesterOptions {
19
19
  }
20
20
 
21
21
  export interface HttpSignerOptions extends SignerOptions {
22
+ keychain: KeychainAdapter
22
23
  portal: HttpRequester
23
24
  }
24
25