@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.
- package/lib/commonjs/providers/index.js +1 -0
- package/lib/commonjs/signers/http.js +1 -3
- package/lib/esm/providers/index.js +1 -0
- package/lib/esm/requesters/http.js +1 -1
- package/lib/esm/signers/http.js +1 -3
- package/package.json +2 -2
- package/src/providers/index.ts +1 -0
- package/src/requesters/http.ts +2 -2
- package/src/signers/http.ts +3 -5
- package/types.d.ts +1 -0
|
@@ -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 =
|
|
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':
|
|
@@ -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://')
|
package/lib/esm/signers/http.js
CHANGED
|
@@ -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 =
|
|
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.
|
|
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.
|
|
20
|
+
"@portal-hq/utils": "^0.2.8"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"typescript": "^4.8.4"
|
package/src/providers/index.ts
CHANGED
package/src/requesters/http.ts
CHANGED
|
@@ -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
|
|
6
|
+
} from '@portal-hq/utils'
|
|
7
7
|
|
|
8
8
|
class HttpRequester {
|
|
9
9
|
private baseUrl: string
|
package/src/signers/http.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
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:
|
|
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 =
|
|
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) {
|