@imtbl/passport 2.0.0-alpha.0
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/LICENSE.md +176 -0
- package/README.md +60 -0
- package/dist/browser/index.js +332 -0
- package/dist/node/index.cjs +332 -0
- package/dist/node/index.js +332 -0
- package/dist/types/Passport.d.ts +84 -0
- package/dist/types/Passport.int.test.d.ts +1 -0
- package/dist/types/Passport.test.d.ts +1 -0
- package/dist/types/authManager.d.ts +59 -0
- package/dist/types/authManager.test.d.ts +1 -0
- package/dist/types/config/config.d.ts +20 -0
- package/dist/types/config/config.test.d.ts +1 -0
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/confirmation/confirmation.d.ts +28 -0
- package/dist/types/confirmation/confirmation.test.d.ts +1 -0
- package/dist/types/confirmation/index.d.ts +2 -0
- package/dist/types/confirmation/popup.d.ts +8 -0
- package/dist/types/confirmation/popup.test.d.ts +1 -0
- package/dist/types/confirmation/types.d.ts +16 -0
- package/dist/types/errors/passportError.d.ts +30 -0
- package/dist/types/errors/passportError.test.d.ts +1 -0
- package/dist/types/guardian/index.d.ts +57 -0
- package/dist/types/guardian/index.test.d.ts +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/magicAdapter.d.ts +10 -0
- package/dist/types/magicAdapter.test.d.ts +1 -0
- package/dist/types/mocks/zkEvm/msw.d.ts +29 -0
- package/dist/types/network/chains.d.ts +32 -0
- package/dist/types/network/constants.d.ts +3 -0
- package/dist/types/network/retry.d.ts +8 -0
- package/dist/types/network/retry.test.d.ts +1 -0
- package/dist/types/overlay/constants.d.ts +6 -0
- package/dist/types/overlay/elements.d.ts +10 -0
- package/dist/types/overlay/index.d.ts +17 -0
- package/dist/types/overlay/overlay.test.d.ts +1 -0
- package/dist/types/starkEx/getStarkSigner.d.ts +3 -0
- package/dist/types/starkEx/getStarkSigner.test.d.ts +1 -0
- package/dist/types/starkEx/index.d.ts +4 -0
- package/dist/types/starkEx/passportImxProvider.d.ts +48 -0
- package/dist/types/starkEx/passportImxProvider.test.d.ts +1 -0
- package/dist/types/starkEx/passportImxProviderFactory.d.ts +28 -0
- package/dist/types/starkEx/passportImxProviderFactory.test.d.ts +1 -0
- package/dist/types/starkEx/workflows/exchange.d.ts +11 -0
- package/dist/types/starkEx/workflows/exchange.test.d.ts +1 -0
- package/dist/types/starkEx/workflows/index.d.ts +5 -0
- package/dist/types/starkEx/workflows/order.d.ts +21 -0
- package/dist/types/starkEx/workflows/order.test.d.ts +1 -0
- package/dist/types/starkEx/workflows/registerOffchain.d.ts +5 -0
- package/dist/types/starkEx/workflows/registerOffchain.test.d.ts +1 -0
- package/dist/types/starkEx/workflows/registration.d.ts +6 -0
- package/dist/types/starkEx/workflows/registration.test.d.ts +1 -0
- package/dist/types/starkEx/workflows/trades.d.ts +13 -0
- package/dist/types/starkEx/workflows/trades.test.d.ts +1 -0
- package/dist/types/starkEx/workflows/transfer.d.ts +21 -0
- package/dist/types/starkEx/workflows/transfer.test.d.ts +1 -0
- package/dist/types/storage/LocalForageAsyncStorage.d.ts +11 -0
- package/dist/types/storage/device_credentials_manager.d.ts +7 -0
- package/dist/types/test/mocks.d.ts +56 -0
- package/dist/types/types.d.ts +166 -0
- package/dist/types/utils/lazyLoad.d.ts +2 -0
- package/dist/types/utils/lazyLoad.test.d.ts +1 -0
- package/dist/types/utils/logger.d.ts +4 -0
- package/dist/types/utils/metrics.d.ts +3 -0
- package/dist/types/utils/metrics.test.d.ts +1 -0
- package/dist/types/utils/string.d.ts +1 -0
- package/dist/types/utils/string.test.d.ts +1 -0
- package/dist/types/utils/token.d.ts +3 -0
- package/dist/types/utils/token.test.d.ts +1 -0
- package/dist/types/utils/typedEventEmitter.d.ts +6 -0
- package/dist/types/utils/typedEventEmitter.test.d.ts +1 -0
- package/dist/types/zkEvm/JsonRpcError.d.ts +25 -0
- package/dist/types/zkEvm/index.d.ts +2 -0
- package/dist/types/zkEvm/personalSign.d.ts +15 -0
- package/dist/types/zkEvm/personalSign.test.d.ts +1 -0
- package/dist/types/zkEvm/provider/eip6963.d.ts +3 -0
- package/dist/types/zkEvm/relayerClient.d.ts +59 -0
- package/dist/types/zkEvm/relayerClient.test.d.ts +1 -0
- package/dist/types/zkEvm/sendDeployTransactionAndPersonalSign.d.ts +6 -0
- package/dist/types/zkEvm/sendDeployTransactionAndPersonalSign.test.d.ts +1 -0
- package/dist/types/zkEvm/sendTransaction.d.ts +6 -0
- package/dist/types/zkEvm/sendTransaction.test.d.ts +1 -0
- package/dist/types/zkEvm/sessionActivity/errorBoundary.d.ts +1 -0
- package/dist/types/zkEvm/sessionActivity/request.d.ts +15 -0
- package/dist/types/zkEvm/sessionActivity/sessionActivity.d.ts +2 -0
- package/dist/types/zkEvm/signEjectionTransaction.d.ts +6 -0
- package/dist/types/zkEvm/signEjectionTransaction.test.d.ts +1 -0
- package/dist/types/zkEvm/signTypedDataV4.d.ts +14 -0
- package/dist/types/zkEvm/signTypedDataV4.test.d.ts +1 -0
- package/dist/types/zkEvm/transactionHelpers.d.ts +29 -0
- package/dist/types/zkEvm/transactionHelpers.test.d.ts +1 -0
- package/dist/types/zkEvm/types.d.ts +114 -0
- package/dist/types/zkEvm/user/index.d.ts +1 -0
- package/dist/types/zkEvm/user/registerZkEvmUser.d.ts +13 -0
- package/dist/types/zkEvm/user/registerZkEvmUser.test.d.ts +1 -0
- package/dist/types/zkEvm/walletHelpers.d.ts +12 -0
- package/dist/types/zkEvm/walletHelpers.test.d.ts +1 -0
- package/dist/types/zkEvm/zkEvmProvider.d.ts +24 -0
- package/dist/types/zkEvm/zkEvmProvider.test.d.ts +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MultiRollupApiClients } from '@imtbl/generated-clients';
|
|
2
|
+
import { Flow } from '@imtbl/metrics';
|
|
3
|
+
import { Signer, JsonRpcProvider } from 'ethers';
|
|
4
|
+
import AuthManager from '../../authManager';
|
|
5
|
+
export type RegisterZkEvmUserInput = {
|
|
6
|
+
authManager: AuthManager;
|
|
7
|
+
ethSigner: Signer;
|
|
8
|
+
multiRollupApiClients: MultiRollupApiClients;
|
|
9
|
+
accessToken: string;
|
|
10
|
+
rpcProvider: JsonRpcProvider;
|
|
11
|
+
flow: Flow;
|
|
12
|
+
};
|
|
13
|
+
export declare function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken, rpcProvider, flow, }: RegisterZkEvmUserInput): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BigNumberish, Signer, JsonRpcProvider } from 'ethers';
|
|
2
|
+
import { MetaTransaction, MetaTransactionNormalised, TypedDataPayload } from './types';
|
|
3
|
+
export declare const getNormalisedTransactions: (txs: MetaTransaction[]) => MetaTransactionNormalised[];
|
|
4
|
+
export declare const digestOfTransactionsAndNonce: (nonce: BigNumberish, normalisedTransactions: MetaTransactionNormalised[]) => string;
|
|
5
|
+
export declare const encodedTransactions: (normalisedTransactions: MetaTransactionNormalised[]) => string;
|
|
6
|
+
export declare const getNonce: (rpcProvider: JsonRpcProvider, smartContractWalletAddress: string) => Promise<bigint>;
|
|
7
|
+
export declare const encodeMessageSubDigest: (chainId: bigint, walletAddress: string, digest: string) => string;
|
|
8
|
+
export declare const signMetaTransactions: (metaTransactions: MetaTransaction[], nonce: BigNumberish, chainId: bigint, walletAddress: string, signer: Signer) => Promise<string>;
|
|
9
|
+
export declare const packSignatures: (EOASignature: string, EOAAddress: string, relayerSignature: string) => string;
|
|
10
|
+
export declare const signAndPackTypedData: (typedData: TypedDataPayload, relayerSignature: string, chainId: bigint, walletAddress: string, signer: Signer) => Promise<string>;
|
|
11
|
+
export declare const signERC191Message: (chainId: bigint, payload: string, signer: Signer, walletAddress: string) => Promise<string>;
|
|
12
|
+
export declare const getEip155ChainId: (chainId: number) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MultiRollupApiClients } from '@imtbl/generated-clients';
|
|
2
|
+
import { Provider, RequestArguments } from './types';
|
|
3
|
+
import AuthManager from '../authManager';
|
|
4
|
+
import MagicAdapter from '../magicAdapter';
|
|
5
|
+
import TypedEventEmitter from '../utils/typedEventEmitter';
|
|
6
|
+
import { PassportConfiguration } from '../config';
|
|
7
|
+
import { PassportEventMap } from '../types';
|
|
8
|
+
import GuardianClient from '../guardian';
|
|
9
|
+
export type ZkEvmProviderInput = {
|
|
10
|
+
authManager: AuthManager;
|
|
11
|
+
magicAdapter: MagicAdapter;
|
|
12
|
+
config: PassportConfiguration;
|
|
13
|
+
multiRollupApiClients: MultiRollupApiClients;
|
|
14
|
+
passportEventEmitter: TypedEventEmitter<PassportEventMap>;
|
|
15
|
+
guardianClient: GuardianClient;
|
|
16
|
+
};
|
|
17
|
+
export declare class ZkEvmProvider implements Provider {
|
|
18
|
+
#private;
|
|
19
|
+
readonly isPassport: boolean;
|
|
20
|
+
constructor({ authManager, magicAdapter, config, multiRollupApiClients, passportEventEmitter, guardianClient, }: ZkEvmProviderInput);
|
|
21
|
+
request(request: RequestArguments): Promise<any>;
|
|
22
|
+
on(event: string, listener: (...args: any[]) => void): void;
|
|
23
|
+
removeListener(event: string, listener: (...args: any[]) => void): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@imtbl/passport",
|
|
3
|
+
"description": "Passport module for Immutable SDK",
|
|
4
|
+
"version": "2.0.0-alpha.0",
|
|
5
|
+
"author": "Immutable",
|
|
6
|
+
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@0xsequence/abi": "^2.0.25",
|
|
9
|
+
"@0xsequence/core": "^2.0.25",
|
|
10
|
+
"@imtbl/config": "2.0.0-alpha.0",
|
|
11
|
+
"@imtbl/generated-clients": "2.0.0-alpha.0",
|
|
12
|
+
"@imtbl/metrics": "2.0.0-alpha.0",
|
|
13
|
+
"@imtbl/toolkit": "2.0.0-alpha.0",
|
|
14
|
+
"@imtbl/x-client": "2.0.0-alpha.0",
|
|
15
|
+
"@imtbl/x-provider": "2.0.0-alpha.0",
|
|
16
|
+
"@magic-ext/oidc": "4.3.1",
|
|
17
|
+
"@magic-sdk/provider": "^21.2.0",
|
|
18
|
+
"@metamask/detect-provider": "^2.0.0",
|
|
19
|
+
"axios": "^1.6.5",
|
|
20
|
+
"ethers": "^6.13.4",
|
|
21
|
+
"events": "^3.3.0",
|
|
22
|
+
"jwt-decode": "^3.1.2",
|
|
23
|
+
"localforage": "^1.10.0",
|
|
24
|
+
"magic-sdk": "^21.2.0",
|
|
25
|
+
"oidc-client-ts": "2.4.0",
|
|
26
|
+
"uuid": "^8.3.2"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@swc/core": "^1.3.36",
|
|
30
|
+
"@swc/jest": "^0.2.24",
|
|
31
|
+
"@types/axios": "^0.14.0",
|
|
32
|
+
"@types/jest": "^29.4.3",
|
|
33
|
+
"@types/jwt-encode": "^1.0.1",
|
|
34
|
+
"@types/react": "^18.3.5",
|
|
35
|
+
"@types/react-dom": "^18.3.0",
|
|
36
|
+
"@types/uuid": "^8.3.4",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
38
|
+
"@typescript-eslint/parser": "^5.57.1",
|
|
39
|
+
"cross-fetch": "^3.1.6",
|
|
40
|
+
"eslint": "^8.40.0",
|
|
41
|
+
"jest": "^29.4.3",
|
|
42
|
+
"jest-environment-jsdom": "^29.4.3",
|
|
43
|
+
"jwt-encode": "^1.0.1",
|
|
44
|
+
"msw": "^1.2.2",
|
|
45
|
+
"prettier": "^2.8.7",
|
|
46
|
+
"ts-node": "^10.9.1",
|
|
47
|
+
"tsup": "^8.3.5",
|
|
48
|
+
"typescript": "^5.6.2"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=20.11.0"
|
|
52
|
+
},
|
|
53
|
+
"exports": {
|
|
54
|
+
"development": {
|
|
55
|
+
"types": "./src/index.ts",
|
|
56
|
+
"browser": "./dist/browser/index.js",
|
|
57
|
+
"require": "./dist/node/index.cjs",
|
|
58
|
+
"default": "./dist/node/index.js"
|
|
59
|
+
},
|
|
60
|
+
"default": {
|
|
61
|
+
"types": "./dist/types/index.d.ts",
|
|
62
|
+
"browser": "./dist/browser/index.js",
|
|
63
|
+
"require": "./dist/node/index.cjs",
|
|
64
|
+
"default": "./dist/node/index.js"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"files": [
|
|
68
|
+
"dist"
|
|
69
|
+
],
|
|
70
|
+
"homepage": "https://github.com/immutable/ts-immutable-sdk#readme",
|
|
71
|
+
"license": "Apache-2.0",
|
|
72
|
+
"main": "dist/node/index.cjs",
|
|
73
|
+
"module": "dist/node/index.js",
|
|
74
|
+
"browser": "dist/browser/index.js",
|
|
75
|
+
"publishConfig": {
|
|
76
|
+
"access": "public"
|
|
77
|
+
},
|
|
78
|
+
"repository": "immutable/ts-immutable-sdk.git",
|
|
79
|
+
"type": "module",
|
|
80
|
+
"types": "./dist/types/index.d.ts",
|
|
81
|
+
"scripts": {
|
|
82
|
+
"build": "pnpm transpile && pnpm typegen",
|
|
83
|
+
"transpile": "tsup src/index.ts --config ../../../tsup.config.js",
|
|
84
|
+
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
|
|
85
|
+
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
|
|
86
|
+
"test": "jest",
|
|
87
|
+
"test:watch": "jest --watch",
|
|
88
|
+
"typecheck": "tsc --customConditions default --noEmit --jsx preserve"
|
|
89
|
+
}
|
|
90
|
+
}
|