@portal-hq/web 0.0.2 → 0.0.3
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/{src/mpc → mpc}/index.js +1 -1
- package/lib/esm/{src/mpc → mpc}/index.js +1 -1
- package/package.json +7 -24
- package/src/mpc/index.ts +1 -1
- package/tsconfig.json +5 -10
- package/types.d.ts +30 -20
- package/CHANGELOG.md +0 -19
- package/README.md +0 -38
- /package/lib/commonjs/{src/index.js → index.js} +0 -0
- /package/lib/commonjs/{src/mpc → mpc}/errors/index.js +0 -0
- /package/lib/commonjs/{src/provider → provider}/errors/index.js +0 -0
- /package/lib/commonjs/{src/provider → provider}/errors/provider-rpc-error.js +0 -0
- /package/lib/commonjs/{src/provider → provider}/index.js +0 -0
- /package/lib/esm/{src/index.js → index.js} +0 -0
- /package/lib/esm/{src/mpc → mpc}/errors/index.js +0 -0
- /package/lib/esm/{src/provider → provider}/errors/index.js +0 -0
- /package/lib/esm/{src/provider → provider}/errors/provider-rpc-error.js +0 -0
- /package/lib/esm/{src/provider → provider}/index.js +0 -0
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MpcErrorCodes = exports.MpcError = void 0;
|
|
13
13
|
const errors_1 = require("./errors");
|
|
14
14
|
const index_1 = require("../index");
|
|
15
|
-
const WEB_SDK_VERSION = '0.0.
|
|
15
|
+
const WEB_SDK_VERSION = '0.0.3';
|
|
16
16
|
class Mpc {
|
|
17
17
|
constructor({ portal }) {
|
|
18
18
|
this.configureIframe = () => {
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { PortalMpcError } from './errors';
|
|
11
11
|
import { BackupMethods } from '../index';
|
|
12
|
-
const WEB_SDK_VERSION = '0.0.
|
|
12
|
+
const WEB_SDK_VERSION = '0.0.3';
|
|
13
13
|
class Mpc {
|
|
14
14
|
constructor({ portal }) {
|
|
15
15
|
this.configureIframe = () => {
|
package/package.json
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
"description": "Portal MPC Support for Web",
|
|
4
4
|
"author": "Portal Labs, Inc.",
|
|
5
5
|
"homepage": "https://portalhq.io/",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.3",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"main": "lib/commonjs/
|
|
9
|
-
"module": "lib/esm/
|
|
8
|
+
"main": "lib/commonjs/index",
|
|
9
|
+
"module": "lib/esm/index",
|
|
10
10
|
"source": "src/index",
|
|
11
11
|
"types": "src/index",
|
|
12
12
|
"files": [
|
|
@@ -18,43 +18,26 @@
|
|
|
18
18
|
"!dist"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
-
"bundle": "rm -rf ./dist && webpack && sh ./scripts/copy-static-files.sh && sh ./scripts/version-worker.sh",
|
|
22
21
|
"coverage": "jest --collect-coverage",
|
|
23
|
-
"lint": "eslint",
|
|
24
22
|
"package": "npm pack && npm run unversion",
|
|
25
|
-
"
|
|
26
|
-
"prepare": "rm -rf ./lib && sh ./scripts/version-mpc.sh && yarn prepare:cjs && yarn prepare:esm && sh ./scripts/post-prepare.sh",
|
|
23
|
+
"prepare": "rm -rf ./lib && sh ./scripts/version.sh && yarn prepare:cjs && yarn prepare:esm && sh ./scripts/post-prepare.sh",
|
|
27
24
|
"prepare:cjs": "tsc --outDir lib/commonjs --module commonjs",
|
|
28
25
|
"prepare:esm": "tsc --outDir lib/esm --module es2015 --target es2015",
|
|
29
|
-
"prerelease": "sh ./scripts/version
|
|
26
|
+
"prerelease": "sh ./scripts/version.sh",
|
|
27
|
+
"release": "npm publish --access public",
|
|
30
28
|
"test": "jest --passWithNoTests",
|
|
31
|
-
"unversion": "sh ./scripts/unversion
|
|
32
|
-
},
|
|
33
|
-
"lint-staged": {
|
|
34
|
-
"*.{js,ts,css,md}": "prettier --write",
|
|
35
|
-
"*.ts": "yarn lint . --quiet"
|
|
29
|
+
"unversion": "sh ./scripts/unversion.sh"
|
|
36
30
|
},
|
|
37
31
|
"devDependencies": {
|
|
38
|
-
"@babel/core": "^7.22.5",
|
|
39
|
-
"@babel/preset-env": "^7.22.5",
|
|
40
|
-
"@babel/preset-typescript": "^7.18.6",
|
|
41
32
|
"@types/gapi": "^0.0.44",
|
|
42
33
|
"@types/gapi.auth2": "^0.0.57",
|
|
43
34
|
"@types/gapi.client.drive": "^3.0.15",
|
|
44
35
|
"@types/google.accounts": "^0.0.7",
|
|
45
36
|
"@types/jest": "^29.2.0",
|
|
46
|
-
"@types/react": "*",
|
|
47
|
-
"@types/react-native": "^0.70.5",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^5.22.0",
|
|
49
|
-
"@typescript-eslint/parser": "^5.22.0",
|
|
50
37
|
"babel-loader": "^9.1.2",
|
|
51
|
-
"eslint": "^8.14.0",
|
|
52
|
-
"husky": "^7.0.4",
|
|
53
38
|
"jest": "^29.2.1",
|
|
54
39
|
"jest-environment-jsdom": "^29.2.2",
|
|
55
40
|
"jwt-decode": "^3.1.2",
|
|
56
|
-
"lint-staged": "^12.3.7",
|
|
57
|
-
"prettier": "^2.6.2",
|
|
58
41
|
"terser-webpack-plugin": "^5.3.9",
|
|
59
42
|
"ts-jest": "^29.0.3",
|
|
60
43
|
"ts-loader": "^9.4.3",
|
package/src/mpc/index.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
3
|
+
"baseUrl": ".",
|
|
4
4
|
"declaration": false,
|
|
5
|
+
"esModuleInterop": true,
|
|
5
6
|
"forceConsistentCasingInFileNames": true,
|
|
6
7
|
"jsx": "react",
|
|
7
8
|
"lib": ["dom", "dom.iterable", "esnext", "es5", "es6"],
|
|
@@ -10,20 +11,14 @@
|
|
|
10
11
|
"noImplicitReturns": true,
|
|
11
12
|
"noUnusedLocals": true,
|
|
12
13
|
"noUnusedParameters": true,
|
|
14
|
+
"outDir": "lib",
|
|
13
15
|
"resolveJsonModule": true,
|
|
14
16
|
"skipLibCheck": true,
|
|
15
17
|
"strict": true,
|
|
16
18
|
"target": "es2015",
|
|
17
|
-
"types": ["jest"]
|
|
18
|
-
"baseUrl": ".",
|
|
19
|
-
"outDir": "lib"
|
|
19
|
+
"types": ["jest"]
|
|
20
20
|
},
|
|
21
|
-
"exclude": [
|
|
22
|
-
"lib",
|
|
23
|
-
"**/node_modules",
|
|
24
|
-
"**/jest.config.ts",
|
|
25
|
-
"**/babel.config.ts"
|
|
26
|
-
],
|
|
21
|
+
"exclude": ["lib", "**/node_modules", "**/jest.config.ts"],
|
|
27
22
|
"files": ["types.d.ts"],
|
|
28
23
|
"include": ["**/*.ts", "**/*.tsx"]
|
|
29
24
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type DkgData, PortalError } from '@portal-hq/utils'
|
|
2
2
|
import type { MpcErrorCodes } from './src/mpc/errors'
|
|
3
3
|
|
|
4
|
-
import Api from '
|
|
5
|
-
import GDriveStorage from '
|
|
4
|
+
import Api from '../iframe/core/api'
|
|
5
|
+
import GDriveStorage from '../iframe/core/storage/gdrive'
|
|
6
6
|
import Portal from './src/index'
|
|
7
7
|
import Provider from './src/provider'
|
|
8
8
|
|
|
@@ -63,6 +63,11 @@ export interface Address {
|
|
|
63
63
|
value: string
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
export interface Balance {
|
|
67
|
+
contractAddress: string
|
|
68
|
+
balance: string
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
export interface ClientWithCustodianData {
|
|
67
72
|
id: string
|
|
68
73
|
address: string
|
|
@@ -234,30 +239,35 @@ export interface MpcStatus {
|
|
|
234
239
|
done: boolean
|
|
235
240
|
}
|
|
236
241
|
|
|
242
|
+
export interface Network {
|
|
243
|
+
id: string
|
|
244
|
+
chainId: string
|
|
245
|
+
name: string
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface NFT {
|
|
249
|
+
contract: NFTContract
|
|
250
|
+
id: TokenId
|
|
251
|
+
balance: string
|
|
252
|
+
title: string
|
|
253
|
+
description: string
|
|
254
|
+
tokenUri: TokenUri
|
|
255
|
+
media: Media[]
|
|
256
|
+
metadata: Metadata
|
|
257
|
+
timeLastUpdated: string
|
|
258
|
+
contractMetadata: ContractMetadata
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface NFTContract {
|
|
262
|
+
address: string
|
|
263
|
+
}
|
|
264
|
+
|
|
237
265
|
export interface PedersonParams {
|
|
238
266
|
n: string
|
|
239
267
|
s: string
|
|
240
268
|
t: string
|
|
241
269
|
}
|
|
242
270
|
|
|
243
|
-
export interface IPortal {
|
|
244
|
-
api?: Api
|
|
245
|
-
apiKey?: string | null
|
|
246
|
-
authenticated: boolean
|
|
247
|
-
authToken?: string
|
|
248
|
-
authUrl?: string
|
|
249
|
-
autoApprove?: boolean
|
|
250
|
-
chainId?: number
|
|
251
|
-
client?: ClientWithCustodianData
|
|
252
|
-
gdrive?: GDriveStorage
|
|
253
|
-
host?: string
|
|
254
|
-
keychain: Keychain
|
|
255
|
-
ready: boolean
|
|
256
|
-
rpcUrl?: string | null
|
|
257
|
-
worker: Worker
|
|
258
|
-
configure: (opts: IframeConfigurationOptions) => void
|
|
259
|
-
}
|
|
260
|
-
|
|
261
271
|
export interface PortalApiOptions {
|
|
262
272
|
apiKey: string
|
|
263
273
|
baseUrl: string
|
package/CHANGELOG.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
Possible Types of changes include:
|
|
5
|
-
|
|
6
|
-
- Added
|
|
7
|
-
- Changed
|
|
8
|
-
- Deprecated
|
|
9
|
-
- Removed
|
|
10
|
-
- Fixed
|
|
11
|
-
- Security
|
|
12
|
-
|
|
13
|
-
## 0.0.1-rc2c 2023-08-25
|
|
14
|
-
|
|
15
|
-
### Added
|
|
16
|
-
|
|
17
|
-
- `portal.api.simulateTransaction`
|
|
18
|
-
- Request using `portal.api.storedClientBackupShareKey` on `backup` and `recover` following successfully saving the client backup share encryption key to the user's backup method.
|
|
19
|
-
- Add unit tests for Google Drive.
|
package/README.md
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# `Portal`
|
|
2
|
-
|
|
3
|
-
The `@portal-hq/web` package includes a class constructor for the `Portal` class, a React Context Provider for the `PortalContext`, the `usePortal` hook for use within child components, and some helpful types and enums for working with Portal in your app. These pieces allow you to initialize `Portal` in your app, expose the instance to your component tree, and consume the instance in your child components.
|
|
4
|
-
|
|
5
|
-
## Type restrictions
|
|
6
|
-
|
|
7
|
-
There are 2 separate `types.d.ts` files in the project: `type.d.ts` and `iframe/types.d.ts`. Because this repo is responsible for building two separate bundles (the one hosted in the GCP bucket, and the one published to `npm`), these two files need to exist in parallel.
|
|
8
|
-
|
|
9
|
-
For this reason, files in the `core` npm package path cannot use types defined in `iframe/types.d.ts` and files in the `iframe` bundle path cannot use types defined in `types.d.ts`. This is because the `iframe` bundle path is not aware of the `core` bundle path and vice versa.
|
|
10
|
-
|
|
11
|
-
Failure to adhere to this restriction will not yield any issues during development, but will cause the build to fail when attempting to publish to `npm`.
|
|
12
|
-
|
|
13
|
-
## Testing the Web SDK
|
|
14
|
-
|
|
15
|
-
We currently use `web-sdk-example` repo to test our web-sdk. Please see [here](https://github.com/portal-hq/web-sdk-example) for more information on how to test.
|
|
16
|
-
|
|
17
|
-
## Releasing the Web SDK
|
|
18
|
-
|
|
19
|
-
There is a helper script in the `package.json` of this package called `prerelease`. This script is used to version and bundle the static files required for a release of the Web SDK. Before releasing a new version of the npm package, this script should be run.
|
|
20
|
-
|
|
21
|
-
### Running the prerelease script
|
|
22
|
-
|
|
23
|
-
In order to run the prerelease script, execute the following from the terminal:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
cd packages/web
|
|
27
|
-
GCP_BUCKET_NAME=XXXXXXX npm run prerelease
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
When the `prerelease` script uploads file to the bucket, it will set `Cache-Control: no-store` for objects uploaded to the staging bucket (`portal-web-sdk-staging-static-files`) so that when developing against staging files don't get cached.
|
|
31
|
-
|
|
32
|
-
### Publishing the npm package
|
|
33
|
-
|
|
34
|
-
Once the prerelease script is executed, you can now publish the npm package.
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
npm publish --access restricted
|
|
38
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|