@layerswap/wallet-imtbl-passport 1.7.0 → 2.0.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/dist/esm/constants.js +2 -0
- package/dist/esm/index.js +20 -18
- package/dist/esm/service/ImtblPassportService.js +85 -0
- package/dist/esm/service/imtblPassportStore.js +6 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/constants.d.ts +3 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/service/ImtblPassportService.d.ts +16 -0
- package/dist/types/service/ImtblPassportService.d.ts.map +1 -0
- package/dist/types/service/imtblPassportStore.d.ts +8 -0
- package/dist/types/service/imtblPassportStore.d.ts.map +1 -0
- package/package.json +8 -12
- package/dist/esm/ImtblPassportProvider.js +0 -43
- package/dist/types/ImtblPassportProvider.d.ts +0 -14
- package/dist/types/ImtblPassportProvider.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,uBAAuB,CAAA;AACxC,eAAO,MAAM,EAAE,kBAAkB,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { WalletWrapper } from "@layerswap/
|
|
1
|
+
import type { WalletWrapper } from "@layerswap/wallet-core/types";
|
|
2
|
+
import { id } from "./constants";
|
|
2
3
|
export type ImtblPassportConfig = {
|
|
3
4
|
publishableKey: string;
|
|
4
5
|
clientId: string;
|
|
@@ -8,11 +9,15 @@ export type ImtblPassportConfig = {
|
|
|
8
9
|
export type ImmutablePassportProviderConfig = {
|
|
9
10
|
imtblPassportConfig?: ImtblPassportConfig;
|
|
10
11
|
};
|
|
11
|
-
export declare function createImmutablePassportProvider(config?: ImmutablePassportProviderConfig): WalletWrapper
|
|
12
|
-
|
|
12
|
+
export declare function createImmutablePassportProvider(config?: ImmutablePassportProviderConfig): WalletWrapper & {
|
|
13
|
+
id: typeof id;
|
|
14
|
+
};
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
+
* Run the Passport OAuth redirect handler. Call this from your redirect page
|
|
17
|
+
* once the route has loaded (e.g. inside a `useEffect`). Replaces the old
|
|
18
|
+
* `<ImtblRedirect />` React component.
|
|
16
19
|
*/
|
|
17
|
-
export declare
|
|
20
|
+
export declare function imtblPassportLoginCallback(config?: ImtblPassportConfig): Promise<void>;
|
|
21
|
+
export { imtblPassportService } from "./service/ImtblPassportService";
|
|
22
|
+
export { useImtblPassportStore } from "./service/imtblPassportStore";
|
|
18
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAEpF,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,MAAM,MAAM,mBAAmB,GAAG;IAC9B,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,MAAM,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;CAC5C,CAAA;AAID,wBAAgB,+BAA+B,CAAC,MAAM,GAAE,+BAAoC,GAAG,aAAa,GAAG;IAAE,EAAE,EAAE,OAAO,EAAE,CAAA;CAAE,CAa/H;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5F;AAED,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Auth } from '@imtbl/auth';
|
|
2
|
+
import type { ImtblPassportConfig } from '..';
|
|
3
|
+
export declare class ImtblPassportService {
|
|
4
|
+
private _config;
|
|
5
|
+
private _initializing;
|
|
6
|
+
private _evmConnected;
|
|
7
|
+
setConfig(config: ImtblPassportConfig | undefined): void;
|
|
8
|
+
hasInstance(): boolean;
|
|
9
|
+
getInstance(): Auth;
|
|
10
|
+
initialize(config?: ImtblPassportConfig): Promise<void>;
|
|
11
|
+
private _doInitialize;
|
|
12
|
+
ensureEvmConnected(): Promise<void>;
|
|
13
|
+
loginCallback(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const imtblPassportService: ImtblPassportService;
|
|
16
|
+
//# sourceMappingURL=ImtblPassportService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImtblPassportService.d.ts","sourceRoot":"","sources":["../../../src/service/ImtblPassportService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,IAAI,CAAA;AAG7C,qBAAa,oBAAoB;IAC7B,OAAO,CAAC,OAAO,CAAiC;IAChD,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,aAAa,CAAQ;IAE7B,SAAS,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI;IAIxD,WAAW,IAAI,OAAO;IAItB,WAAW,IAAI,IAAI;IAQb,UAAU,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;YAW/C,aAAa;IA2BrB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAwBnC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAIvC;AAED,eAAO,MAAM,oBAAoB,sBAA6B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Auth } from '@imtbl/auth';
|
|
2
|
+
export type ImtblPassportStoreState = {
|
|
3
|
+
ready: boolean;
|
|
4
|
+
instance: Auth | undefined;
|
|
5
|
+
_setInstance: (instance: Auth | undefined) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const useImtblPassportStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ImtblPassportStoreState>>;
|
|
8
|
+
//# sourceMappingURL=imtblPassportStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imtblPassportStore.d.ts","sourceRoot":"","sources":["../../../src/service/imtblPassportStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,MAAM,MAAM,uBAAuB,GAAG;IAClC,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAA;IAE1B,YAAY,EAAE,CAAC,QAAQ,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;CACrD,CAAA;AAED,eAAO,MAAM,qBAAqB,sFAK/B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerswap/wallet-imtbl-passport",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "ImmutablePassport Wallet Provider for Layerswap Widget",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
24
|
"url": "git+https://github.com/layerswap/layerswapapp.git",
|
|
25
|
-
"directory": "packages/wallets/imtblPassport"
|
|
25
|
+
"directory": "packages/wallets/adapters/imtblPassport"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
28
|
"layerswap",
|
|
@@ -31,20 +31,16 @@
|
|
|
31
31
|
],
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"@layerswap/widget": "^1.7.0"
|
|
34
|
+
"zustand": "^4.5.7",
|
|
35
|
+
"@layerswap/wallet-core": "^2.0.0"
|
|
37
36
|
},
|
|
38
37
|
"dependencies": {
|
|
39
|
-
"@imtbl/
|
|
40
|
-
"@imtbl/
|
|
41
|
-
"axios": "1.16.0"
|
|
38
|
+
"@imtbl/auth": "2.20.2",
|
|
39
|
+
"@imtbl/wallet": "2.20.2"
|
|
42
40
|
},
|
|
43
41
|
"devDependencies": {
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"react-dom": "19.2.3",
|
|
47
|
-
"@layerswap/widget": "^1.7.0"
|
|
42
|
+
"zustand": "^4.5.7",
|
|
43
|
+
"@layerswap/wallet-core": "^2.0.0"
|
|
48
44
|
},
|
|
49
45
|
"engines": {
|
|
50
46
|
"node": ">=22"
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
export const initilizePassport = async (configs) => {
|
|
4
|
-
const { publishableKey, clientId, redirectUri, logoutRedirectUri } = configs || {};
|
|
5
|
-
const passport = await import('@imtbl/passport');
|
|
6
|
-
const config = await import('@imtbl/config');
|
|
7
|
-
if (publishableKey && clientId && redirectUri && logoutRedirectUri) {
|
|
8
|
-
passportInstance = new passport.Passport({
|
|
9
|
-
baseConfig: {
|
|
10
|
-
environment: publishableKey.includes('pk_imapik-test') ? config.Environment.SANDBOX : config.Environment.PRODUCTION,
|
|
11
|
-
publishableKey: publishableKey,
|
|
12
|
-
},
|
|
13
|
-
clientId: clientId,
|
|
14
|
-
audience: 'platform_api',
|
|
15
|
-
scope: 'openid offline_access email transact',
|
|
16
|
-
redirectUri,
|
|
17
|
-
logoutRedirectUri,
|
|
18
|
-
logoutMode: 'silent',
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
export var passportInstance = undefined;
|
|
23
|
-
export function ImtblPassportProviderWrapper({ children, imtblPassportConfig }) {
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (!passportInstance) {
|
|
26
|
-
(async () => {
|
|
27
|
-
await initilizePassport(imtblPassportConfig);
|
|
28
|
-
passportInstance.connectEvm(); // EIP-6963
|
|
29
|
-
})();
|
|
30
|
-
}
|
|
31
|
-
}, [passportInstance, imtblPassportConfig]);
|
|
32
|
-
return (_jsx(_Fragment, { children: children }));
|
|
33
|
-
}
|
|
34
|
-
export const ImtblRedirect = ({ imtblPassportConfig }) => {
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
(async () => {
|
|
37
|
-
if (!passportInstance)
|
|
38
|
-
await initilizePassport(imtblPassportConfig);
|
|
39
|
-
passportInstance.loginCallback();
|
|
40
|
-
})();
|
|
41
|
-
}, [passportInstance, imtblPassportConfig]);
|
|
42
|
-
return (_jsx("div", { children: _jsx("h1", { children: "Redirecting..." }) }));
|
|
43
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { ImtblPassportConfig } from "./index";
|
|
3
|
-
export declare const initilizePassport: (configs: ImtblPassportConfig | undefined) => Promise<void>;
|
|
4
|
-
export declare var passportInstance: any;
|
|
5
|
-
type ImtblPassportProviderWrapperProps = {
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
imtblPassportConfig?: ImtblPassportConfig;
|
|
8
|
-
};
|
|
9
|
-
export declare function ImtblPassportProviderWrapper({ children, imtblPassportConfig }: ImtblPassportProviderWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare const ImtblRedirect: ({ imtblPassportConfig }: {
|
|
11
|
-
imtblPassportConfig?: ImtblPassportConfig;
|
|
12
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=ImtblPassportProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ImtblPassportProvider.d.ts","sourceRoot":"","sources":["../../src/ImtblPassportProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,iBAAiB,GAAU,SAAS,mBAAmB,GAAG,SAAS,kBAqB/E,CAAA;AAED,eAAO,IAAI,gBAAgB,EAAE,GAAe,CAAA;AAE5C,KAAK,iCAAiC,GAAG;IACrC,QAAQ,EAAE,SAAS,CAAA;IACnB,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;CAC5C,CAAA;AAED,wBAAgB,4BAA4B,CAAC,EAAE,QAAQ,EAAE,mBAAmB,EAAE,EAAE,iCAAiC,2CAgBhH;AAED,eAAO,MAAM,aAAa,GAAI,yBAAyB;IAAE,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;CAAE,4CAcnG,CAAA"}
|