@portal-hq/provider 0.3.5 → 0.3.6
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.
|
@@ -23,7 +23,8 @@ const signerMethods = [
|
|
|
23
23
|
'eth_sendTransaction',
|
|
24
24
|
'eth_sign',
|
|
25
25
|
'eth_signTransaction',
|
|
26
|
-
'
|
|
26
|
+
'eth_signTypedData_v3',
|
|
27
|
+
'eth_signTypedData_v4',
|
|
27
28
|
'personal_sign',
|
|
28
29
|
];
|
|
29
30
|
class Provider {
|
|
@@ -31,7 +32,7 @@ class Provider {
|
|
|
31
32
|
// Required options
|
|
32
33
|
apiKey, chainId, keychain,
|
|
33
34
|
// Optional options
|
|
34
|
-
apiUrl = 'api.portalhq.io', autoApprove = false, mpcUrl = 'mpc.portalhq.io', mpcVersion = '
|
|
35
|
+
apiUrl = 'api.portalhq.io', autoApprove = false, mpcUrl = 'mpc.portalhq.io', mpcVersion = 'v3', gatewayConfig = {}, }) {
|
|
35
36
|
// Handle required fields
|
|
36
37
|
if (!apiKey || apiKey.length === 0) {
|
|
37
38
|
throw new utils_1.InvalidApiKeyError();
|
|
@@ -362,7 +363,8 @@ class Provider {
|
|
|
362
363
|
case 'eth_sendTransaction':
|
|
363
364
|
case 'eth_sign':
|
|
364
365
|
case 'eth_signTransaction':
|
|
365
|
-
case '
|
|
366
|
+
case 'eth_signTypedData_v3':
|
|
367
|
+
case 'eth_signTypedData_v4':
|
|
366
368
|
case 'personal_sign':
|
|
367
369
|
const result = yield ((_a = this.signer) === null || _a === void 0 ? void 0 : _a.sign({ chainId: this.chainId, method, params }, this));
|
|
368
370
|
if (result) {
|
|
@@ -12,8 +12,8 @@ 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, mpcUrl, mpcVersion = '
|
|
16
|
-
this.mpcVersion = '
|
|
15
|
+
constructor({ keychain, mpcUrl, mpcVersion = 'v3' }) {
|
|
16
|
+
this.mpcVersion = 'v3';
|
|
17
17
|
this.buildParams = (method, txParams) => {
|
|
18
18
|
let params = txParams;
|
|
19
19
|
switch (method) {
|
|
@@ -21,7 +21,8 @@ const signerMethods = [
|
|
|
21
21
|
'eth_sendTransaction',
|
|
22
22
|
'eth_sign',
|
|
23
23
|
'eth_signTransaction',
|
|
24
|
-
'
|
|
24
|
+
'eth_signTypedData_v3',
|
|
25
|
+
'eth_signTypedData_v4',
|
|
25
26
|
'personal_sign',
|
|
26
27
|
];
|
|
27
28
|
class Provider {
|
|
@@ -29,7 +30,7 @@ class Provider {
|
|
|
29
30
|
// Required options
|
|
30
31
|
apiKey, chainId, keychain,
|
|
31
32
|
// Optional options
|
|
32
|
-
apiUrl = 'api.portalhq.io', autoApprove = false, mpcUrl = 'mpc.portalhq.io', mpcVersion = '
|
|
33
|
+
apiUrl = 'api.portalhq.io', autoApprove = false, mpcUrl = 'mpc.portalhq.io', mpcVersion = 'v3', gatewayConfig = {}, }) {
|
|
33
34
|
// Handle required fields
|
|
34
35
|
if (!apiKey || apiKey.length === 0) {
|
|
35
36
|
throw new InvalidApiKeyError();
|
|
@@ -360,7 +361,8 @@ class Provider {
|
|
|
360
361
|
case 'eth_sendTransaction':
|
|
361
362
|
case 'eth_sign':
|
|
362
363
|
case 'eth_signTransaction':
|
|
363
|
-
case '
|
|
364
|
+
case 'eth_signTypedData_v3':
|
|
365
|
+
case 'eth_signTypedData_v4':
|
|
364
366
|
case 'personal_sign':
|
|
365
367
|
const result = yield ((_a = this.signer) === null || _a === void 0 ? void 0 : _a.sign({ chainId: this.chainId, method, params }, this));
|
|
366
368
|
if (result) {
|
package/lib/esm/signers/mpc.js
CHANGED
|
@@ -10,8 +10,8 @@ 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, mpcUrl, mpcVersion = '
|
|
14
|
-
this.mpcVersion = '
|
|
13
|
+
constructor({ keychain, mpcUrl, mpcVersion = 'v3' }) {
|
|
14
|
+
this.mpcVersion = 'v3';
|
|
15
15
|
this.buildParams = (method, txParams) => {
|
|
16
16
|
let params = txParams;
|
|
17
17
|
switch (method) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portal-hq/provider",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/esm/index",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"test": "jest"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@portal-hq/utils": "^0.3.
|
|
22
|
+
"@portal-hq/utils": "^0.3.6"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@babel/preset-typescript": "^7.18.6",
|
package/src/providers/index.ts
CHANGED
|
@@ -32,7 +32,8 @@ const signerMethods = [
|
|
|
32
32
|
'eth_sendTransaction',
|
|
33
33
|
'eth_sign',
|
|
34
34
|
'eth_signTransaction',
|
|
35
|
-
'
|
|
35
|
+
'eth_signTypedData_v3',
|
|
36
|
+
'eth_signTypedData_v4',
|
|
36
37
|
'personal_sign',
|
|
37
38
|
]
|
|
38
39
|
|
|
@@ -66,7 +67,7 @@ class Provider {
|
|
|
66
67
|
apiUrl = 'api.portalhq.io',
|
|
67
68
|
autoApprove = false,
|
|
68
69
|
mpcUrl = 'mpc.portalhq.io',
|
|
69
|
-
mpcVersion = '
|
|
70
|
+
mpcVersion = 'v3',
|
|
70
71
|
gatewayConfig = {},
|
|
71
72
|
}: ProviderOptions) {
|
|
72
73
|
// Handle required fields
|
|
@@ -470,7 +471,8 @@ class Provider {
|
|
|
470
471
|
case 'eth_sendTransaction':
|
|
471
472
|
case 'eth_sign':
|
|
472
473
|
case 'eth_signTransaction':
|
|
473
|
-
case '
|
|
474
|
+
case 'eth_signTypedData_v3':
|
|
475
|
+
case 'eth_signTypedData_v4':
|
|
474
476
|
case 'personal_sign':
|
|
475
477
|
const result = await this.signer?.sign(
|
|
476
478
|
{ chainId: this.chainId, method, params },
|
package/src/signers/mpc.ts
CHANGED
|
@@ -20,9 +20,9 @@ class MpcSigner implements Signer {
|
|
|
20
20
|
public address?: string
|
|
21
21
|
public keychain: KeychainAdapter
|
|
22
22
|
public mpcUrl: string // should we add a default here mpc.portalhq.io
|
|
23
|
-
public mpcVersion: string = '
|
|
23
|
+
public mpcVersion: string = 'v3'
|
|
24
24
|
|
|
25
|
-
constructor({ keychain, mpcUrl, mpcVersion = '
|
|
25
|
+
constructor({ keychain, mpcUrl, mpcVersion = 'v3' }: MpcSignerOptions) {
|
|
26
26
|
this.keychain = keychain
|
|
27
27
|
this.mpc = NativeModules.PortalMobileMpc
|
|
28
28
|
this.mpcUrl = mpcUrl
|