@frak-labs/core-sdk 0.1.0-beta.dd44738a → 0.1.0-beta.ebc9d3a3
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/cdn/bundle.js +5 -5
- package/cdn/bundle.js.LICENSE.txt +0 -2
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +1 -1
- package/dist/bundle.cjs +2 -2
- package/dist/bundle.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/interactions.cjs +1 -1
- package/dist/interactions.js +1 -1
- package/package.json +9 -9
- package/src/actions/index.ts +19 -19
- package/src/bundle.ts +1 -1
- package/src/clients/createIFrameFrakClient.ts +2 -2
- package/src/clients/index.ts +1 -1
- package/src/clients/setupClient.ts +3 -1
- package/src/clients/transports/iframeLifecycleManager.ts +3 -1
- package/src/index.ts +72 -74
- package/src/interactions/index.ts +2 -2
- package/src/interactions/pressEncoder.ts +1 -1
- package/src/interactions/purchaseEncoder.ts +8 -3
- package/src/interactions/retailEncoder.ts +1 -1
- package/src/types/index.ts +51 -50
- package/src/types/lifecycle/index.ts +1 -1
- package/src/types/rpc/modal/index.ts +11 -11
- package/src/utils/FrakContext.ts +8 -2
- package/src/utils/compression/index.ts +1 -1
- package/src/utils/iframeHelper.ts +4 -3
- package/src/utils/index.ts +12 -12
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "0.1.0-beta.
|
|
14
|
+
"version": "0.1.0-beta.ebc9d3a3",
|
|
15
15
|
"description": "Core SDK of the Frak wallet, low level library to interact directly with the frak ecosystem.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -96,23 +96,23 @@
|
|
|
96
96
|
"publish": "echo 'Publishing core...'"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"viem": "^2.
|
|
99
|
+
"viem": "^2.x"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"@frak-labs/frame-connector": "0.1.0",
|
|
103
|
-
"@jsonjoy.com/json-pack": "^1.
|
|
103
|
+
"@jsonjoy.com/json-pack": "^1.21.0",
|
|
104
104
|
"@openpanel/web": "^1.0.1"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
108
108
|
"@frak-labs/browserslist-config": "0.0.1",
|
|
109
109
|
"@frak-labs/dev-tooling": "0.0.0",
|
|
110
|
-
"@microsoft/api-extractor": "^7.
|
|
111
|
-
"@rsbuild/plugin-node-polyfill": "^1.
|
|
112
|
-
"@rslib/core": "
|
|
113
|
-
"@types/node": "^24.
|
|
114
|
-
"
|
|
115
|
-
"
|
|
110
|
+
"@microsoft/api-extractor": "^7.53.3",
|
|
111
|
+
"@rsbuild/plugin-node-polyfill": "^1.4.2",
|
|
112
|
+
"@rslib/core": "0.16.1",
|
|
113
|
+
"@types/node": "^24.9.1",
|
|
114
|
+
"typescript": "^5.9.3",
|
|
115
|
+
"viem": "^2.38.3"
|
|
116
116
|
},
|
|
117
117
|
"browserslist": [
|
|
118
118
|
"extends @frak-labs/browserslist-config"
|
package/src/actions/index.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
export { watchWalletStatus } from "./watchWalletStatus";
|
|
2
|
-
export { sendInteraction } from "./sendInteraction";
|
|
3
|
-
export { displayModal } from "./displayModal";
|
|
4
1
|
export { displayEmbeddedWallet } from "./displayEmbeddedWallet";
|
|
2
|
+
export { displayModal } from "./displayModal";
|
|
3
|
+
export { getProductInformation } from "./getProductInformation";
|
|
5
4
|
export { openSso } from "./openSso";
|
|
6
5
|
export { prepareSso } from "./prepareSso";
|
|
7
|
-
export {
|
|
6
|
+
export {
|
|
7
|
+
type ProcessReferralOptions,
|
|
8
|
+
processReferral,
|
|
9
|
+
} from "./referral/processReferral";
|
|
10
|
+
// Referral interaction
|
|
11
|
+
export { referralInteraction } from "./referral/referralInteraction";
|
|
12
|
+
export { sendInteraction } from "./sendInteraction";
|
|
8
13
|
// Helper to track the purchase status
|
|
9
14
|
export { trackPurchaseStatus } from "./trackPurchaseStatus";
|
|
10
|
-
|
|
15
|
+
export { watchWalletStatus } from "./watchWalletStatus";
|
|
11
16
|
export {
|
|
12
|
-
|
|
13
|
-
type
|
|
14
|
-
|
|
17
|
+
type ModalBuilder,
|
|
18
|
+
type ModalStepBuilder,
|
|
19
|
+
modalBuilder,
|
|
20
|
+
} from "./wrapper/modalBuilder";
|
|
15
21
|
export {
|
|
16
|
-
sendTransaction,
|
|
17
22
|
type SendTransactionParams,
|
|
23
|
+
sendTransaction,
|
|
18
24
|
} from "./wrapper/sendTransaction";
|
|
25
|
+
// Modal wrappers
|
|
19
26
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from "./wrapper/modalBuilder";
|
|
24
|
-
// Referral interaction
|
|
25
|
-
export { referralInteraction } from "./referral/referralInteraction";
|
|
26
|
-
export {
|
|
27
|
-
processReferral,
|
|
28
|
-
type ProcessReferralOptions,
|
|
29
|
-
} from "./referral/processReferral";
|
|
27
|
+
type SiweAuthenticateModalParams,
|
|
28
|
+
siweAuthenticate,
|
|
29
|
+
} from "./wrapper/siweAuthenticate";
|
package/src/bundle.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createRpcClient,
|
|
2
3
|
FrakRpcError,
|
|
3
4
|
type RpcClient,
|
|
4
5
|
RpcErrorCodes,
|
|
5
|
-
createRpcClient,
|
|
6
6
|
} from "@frak-labs/frame-connector";
|
|
7
7
|
import { createClientCompressionMiddleware } from "@frak-labs/frame-connector/middleware";
|
|
8
8
|
import { OpenPanel } from "@openpanel/web";
|
|
@@ -14,8 +14,8 @@ import { BACKUP_KEY } from "../utils/constants";
|
|
|
14
14
|
import { setupSsoUrlListener } from "../utils/ssoUrlListener";
|
|
15
15
|
import { DebugInfoGatherer } from "./DebugInfo";
|
|
16
16
|
import {
|
|
17
|
-
type IframeLifecycleManager,
|
|
18
17
|
createIFrameLifecycleManager,
|
|
18
|
+
type IframeLifecycleManager,
|
|
19
19
|
} from "./transports/iframeLifecycleManager";
|
|
20
20
|
|
|
21
21
|
type SdkRpcClient = RpcClient<IFrameRpcSchema, FrakLifecycleEvent>;
|
package/src/clients/index.ts
CHANGED
|
@@ -19,7 +19,9 @@ import { createIframe, getSupportedCurrency } from "../utils";
|
|
|
19
19
|
*/
|
|
20
20
|
export async function setupClient({
|
|
21
21
|
config,
|
|
22
|
-
}: {
|
|
22
|
+
}: {
|
|
23
|
+
config: FrakWalletSdkConfig;
|
|
24
|
+
}): Promise<FrakClient | undefined> {
|
|
23
25
|
// Prepare the config
|
|
24
26
|
const preparedConfig = prepareConfig(config);
|
|
25
27
|
|
|
@@ -15,7 +15,9 @@ export type IframeLifecycleManager = {
|
|
|
15
15
|
*/
|
|
16
16
|
export function createIFrameLifecycleManager({
|
|
17
17
|
iframe,
|
|
18
|
-
}: {
|
|
18
|
+
}: {
|
|
19
|
+
iframe: HTMLIFrameElement;
|
|
20
|
+
}): IframeLifecycleManager {
|
|
19
21
|
// Create the isConnected listener
|
|
20
22
|
const isConnectedDeferred = new Deferred<boolean>();
|
|
21
23
|
|
package/src/index.ts
CHANGED
|
@@ -1,103 +1,101 @@
|
|
|
1
1
|
// Clients
|
|
2
|
+
|
|
3
|
+
export { ssoPopupFeatures, ssoPopupName } from "./actions/openSso";
|
|
2
4
|
export {
|
|
3
5
|
createIFrameFrakClient,
|
|
4
|
-
setupClient,
|
|
5
6
|
DebugInfoGatherer,
|
|
7
|
+
setupClient,
|
|
6
8
|
} from "./clients";
|
|
7
|
-
|
|
8
|
-
// Utils
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
findIframeInOpener,
|
|
16
|
-
getSupportedCurrency,
|
|
17
|
-
getSupportedLocale,
|
|
18
|
-
getCurrencyAmountKey,
|
|
19
|
-
formatAmount,
|
|
20
|
-
base64urlDecode,
|
|
21
|
-
base64urlEncode,
|
|
22
|
-
trackEvent,
|
|
23
|
-
generateSsoUrl,
|
|
24
|
-
type CompressedSsoData,
|
|
25
|
-
type FullSsoParams,
|
|
26
|
-
type AppSpecificSsoMetadata,
|
|
27
|
-
} from "./utils";
|
|
28
|
-
|
|
10
|
+
type FullInteractionTypesKey,
|
|
11
|
+
type InteractionTypesKey,
|
|
12
|
+
interactionTypes,
|
|
13
|
+
} from "./constants/interactionTypes";
|
|
14
|
+
export { type LocalesKey, locales } from "./constants/locales";
|
|
29
15
|
// Constants
|
|
30
16
|
export {
|
|
31
17
|
type ProductTypesKey,
|
|
32
18
|
productTypes,
|
|
33
19
|
productTypesMask,
|
|
34
20
|
} from "./constants/productTypes";
|
|
35
|
-
export {
|
|
36
|
-
interactionTypes,
|
|
37
|
-
type InteractionTypesKey,
|
|
38
|
-
type FullInteractionTypesKey,
|
|
39
|
-
} from "./constants/interactionTypes";
|
|
40
|
-
export { locales, type LocalesKey } from "./constants/locales";
|
|
41
|
-
export { ssoPopupFeatures, ssoPopupName } from "./actions/openSso";
|
|
42
|
-
|
|
43
21
|
// Types
|
|
44
22
|
export type {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
IFrameRpcSchema,
|
|
48
|
-
PreparedInteraction,
|
|
49
|
-
SendInteractionParamsType,
|
|
50
|
-
SendInteractionReturnType,
|
|
51
|
-
SsoMetadata,
|
|
52
|
-
PrepareSsoParamsType,
|
|
53
|
-
PrepareSsoReturnType,
|
|
54
|
-
OpenSsoParamsType,
|
|
55
|
-
OpenSsoReturnType,
|
|
23
|
+
ClientLifecycleEvent,
|
|
24
|
+
CompressedData,
|
|
56
25
|
Currency,
|
|
57
|
-
Language,
|
|
58
|
-
I18nConfig,
|
|
59
|
-
LocalizedI18nConfig,
|
|
60
|
-
TokenAmountType,
|
|
61
|
-
GetProductInformationReturnType,
|
|
62
26
|
// RPC Embedded wallet
|
|
63
27
|
DisplayEmbeddedWalletParamsType,
|
|
64
28
|
DisplayEmbeddedWalletResultType,
|
|
65
|
-
|
|
66
|
-
LoggedInEmbeddedView,
|
|
29
|
+
DisplayModalParamsType,
|
|
67
30
|
EmbeddedViewActionReferred,
|
|
68
31
|
EmbeddedViewActionSharing,
|
|
69
|
-
// RPC Modal generics
|
|
70
|
-
ModalStepTypes,
|
|
71
|
-
ModalRpcMetadata,
|
|
72
|
-
DisplayModalParamsType,
|
|
73
|
-
ModalRpcStepsInput,
|
|
74
|
-
ModalRpcStepsResultType,
|
|
75
|
-
// RPC Modal types
|
|
76
|
-
ModalStepMetadata,
|
|
77
|
-
LoginModalStepType,
|
|
78
|
-
SiweAuthenticateModalStepType,
|
|
79
|
-
SiweAuthenticationParams,
|
|
80
|
-
SiweAuthenticateReturnType,
|
|
81
|
-
SendTransactionTxType,
|
|
82
|
-
SendTransactionModalStepType,
|
|
83
|
-
SendTransactionReturnType,
|
|
84
|
-
OpenInteractionSessionReturnType,
|
|
85
|
-
OpenInteractionSessionModalStepType,
|
|
86
|
-
FinalModalStepType,
|
|
87
32
|
FinalActionType,
|
|
33
|
+
FinalModalStepType,
|
|
88
34
|
// Client
|
|
89
35
|
FrakClient,
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
IFrameLifecycleEvent,
|
|
93
|
-
ClientLifecycleEvent,
|
|
36
|
+
// Utils
|
|
37
|
+
FrakContext,
|
|
94
38
|
FrakLifecycleEvent,
|
|
95
39
|
// Config
|
|
96
40
|
FrakWalletSdkConfig,
|
|
41
|
+
GetProductInformationReturnType,
|
|
42
|
+
HashProtectedData,
|
|
43
|
+
I18nConfig,
|
|
44
|
+
IFrameLifecycleEvent,
|
|
45
|
+
IFrameRpcSchema,
|
|
46
|
+
// Transport
|
|
47
|
+
IFrameTransport,
|
|
97
48
|
// Compression
|
|
98
49
|
KeyProvider,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
50
|
+
Language,
|
|
51
|
+
LocalizedI18nConfig,
|
|
52
|
+
LoggedInEmbeddedView,
|
|
53
|
+
LoggedOutEmbeddedView,
|
|
54
|
+
LoginModalStepType,
|
|
55
|
+
ModalRpcMetadata,
|
|
56
|
+
ModalRpcStepsInput,
|
|
57
|
+
ModalRpcStepsResultType,
|
|
58
|
+
// RPC Modal types
|
|
59
|
+
ModalStepMetadata,
|
|
60
|
+
// RPC Modal generics
|
|
61
|
+
ModalStepTypes,
|
|
62
|
+
OpenInteractionSessionModalStepType,
|
|
63
|
+
OpenInteractionSessionReturnType,
|
|
64
|
+
OpenSsoParamsType,
|
|
65
|
+
OpenSsoReturnType,
|
|
66
|
+
PreparedInteraction,
|
|
67
|
+
PrepareSsoParamsType,
|
|
68
|
+
PrepareSsoReturnType,
|
|
69
|
+
SendInteractionParamsType,
|
|
70
|
+
SendInteractionReturnType,
|
|
71
|
+
SendTransactionModalStepType,
|
|
72
|
+
SendTransactionReturnType,
|
|
73
|
+
SendTransactionTxType,
|
|
74
|
+
SiweAuthenticateModalStepType,
|
|
75
|
+
SiweAuthenticateReturnType,
|
|
76
|
+
SiweAuthenticationParams,
|
|
77
|
+
SsoMetadata,
|
|
78
|
+
TokenAmountType,
|
|
79
|
+
// Rpc
|
|
80
|
+
WalletStatusReturnType,
|
|
103
81
|
} from "./types";
|
|
82
|
+
// Utils
|
|
83
|
+
export {
|
|
84
|
+
type AppSpecificSsoMetadata,
|
|
85
|
+
base64urlDecode,
|
|
86
|
+
base64urlEncode,
|
|
87
|
+
baseIframeProps,
|
|
88
|
+
type CompressedSsoData,
|
|
89
|
+
compressJsonToB64,
|
|
90
|
+
createIframe,
|
|
91
|
+
decompressJsonFromB64,
|
|
92
|
+
FrakContextManager,
|
|
93
|
+
type FullSsoParams,
|
|
94
|
+
findIframeInOpener,
|
|
95
|
+
formatAmount,
|
|
96
|
+
generateSsoUrl,
|
|
97
|
+
getCurrencyAmountKey,
|
|
98
|
+
getSupportedCurrency,
|
|
99
|
+
getSupportedLocale,
|
|
100
|
+
trackEvent,
|
|
101
|
+
} from "./utils";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { PressInteractionEncoder } from "./pressEncoder";
|
|
2
|
-
export { ReferralInteractionEncoder } from "./referralEncoder";
|
|
3
2
|
export { PurchaseInteractionEncoder } from "./purchaseEncoder";
|
|
4
|
-
export {
|
|
3
|
+
export { ReferralInteractionEncoder } from "./referralEncoder";
|
|
5
4
|
export { RetailInteractionEncoder } from "./retailEncoder";
|
|
5
|
+
export { WebShopInteractionEncoder } from "./webshopEncoder";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Hex,
|
|
1
|
+
import { concatHex, type Hex, pad, toHex } from "viem";
|
|
2
2
|
import { interactionTypes } from "../constants/interactionTypes";
|
|
3
3
|
import { productTypes } from "../constants/productTypes";
|
|
4
4
|
import type { PreparedInteraction } from "../types";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { concatHex, encodeAbiParameters, type Hex, pad, toHex } from "viem";
|
|
2
2
|
import { interactionTypes } from "../constants/interactionTypes";
|
|
3
3
|
import { productTypes } from "../constants/productTypes";
|
|
4
4
|
import type { PreparedInteraction } from "../types";
|
|
@@ -59,7 +59,10 @@ export const PurchaseInteractionEncoder = {
|
|
|
59
59
|
completedPurchase({
|
|
60
60
|
purchaseId,
|
|
61
61
|
proof,
|
|
62
|
-
}: {
|
|
62
|
+
}: {
|
|
63
|
+
purchaseId: Hex;
|
|
64
|
+
proof: Hex[];
|
|
65
|
+
}): PreparedInteraction {
|
|
63
66
|
const innerData = encodeAbiParameters(
|
|
64
67
|
[{ type: "uint256" }, { type: "bytes32[]" }],
|
|
65
68
|
[BigInt(purchaseId), proof]
|
|
@@ -81,7 +84,9 @@ export const PurchaseInteractionEncoder = {
|
|
|
81
84
|
*/
|
|
82
85
|
unsafeCompletedPurchase({
|
|
83
86
|
purchaseId,
|
|
84
|
-
}: {
|
|
87
|
+
}: {
|
|
88
|
+
purchaseId: Hex;
|
|
89
|
+
}): PreparedInteraction {
|
|
85
90
|
const interactionData = concatHex([
|
|
86
91
|
interactionTypes.purchase.unsafeCompleted,
|
|
87
92
|
pad(purchaseId, { size: 32 }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Hex,
|
|
1
|
+
import { concatHex, type Hex, pad, toHex } from "viem";
|
|
2
2
|
import { interactionTypes } from "../constants/interactionTypes";
|
|
3
3
|
import { productTypes } from "../constants/productTypes";
|
|
4
4
|
import type { PreparedInteraction } from "../types";
|
package/src/types/index.ts
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
1
|
// Rpc related
|
|
2
|
-
|
|
3
|
-
export type {
|
|
4
|
-
DisplayEmbeddedWalletParamsType,
|
|
5
|
-
DisplayEmbeddedWalletResultType,
|
|
6
|
-
LoggedOutEmbeddedView,
|
|
7
|
-
LoggedInEmbeddedView,
|
|
8
|
-
EmbeddedViewActionReferred,
|
|
9
|
-
EmbeddedViewActionSharing,
|
|
10
|
-
} from "./rpc/embedded";
|
|
11
|
-
export type {
|
|
12
|
-
SsoMetadata,
|
|
13
|
-
OpenSsoParamsType,
|
|
14
|
-
OpenSsoReturnType,
|
|
15
|
-
PrepareSsoParamsType,
|
|
16
|
-
PrepareSsoReturnType,
|
|
17
|
-
} from "./rpc/sso";
|
|
18
|
-
export type {
|
|
19
|
-
TokenAmountType,
|
|
20
|
-
GetProductInformationReturnType,
|
|
21
|
-
} from "./rpc/productInformation";
|
|
22
|
-
export type {
|
|
23
|
-
PreparedInteraction,
|
|
24
|
-
SendInteractionParamsType,
|
|
25
|
-
SendInteractionReturnType,
|
|
26
|
-
} from "./rpc/interaction";
|
|
27
|
-
export type { IFrameRpcSchema } from "./rpc";
|
|
2
|
+
|
|
28
3
|
// Client related
|
|
29
4
|
export type { FrakClient } from "./client";
|
|
30
|
-
export type { IFrameTransport, FrakLifecycleEvent } from "./transport";
|
|
31
5
|
export type {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
CompressedData,
|
|
7
|
+
HashProtectedData,
|
|
8
|
+
KeyProvider,
|
|
9
|
+
} from "./compression";
|
|
35
10
|
export type {
|
|
36
|
-
FrakWalletSdkConfig,
|
|
37
11
|
Currency,
|
|
38
|
-
|
|
12
|
+
FrakWalletSdkConfig,
|
|
39
13
|
I18nConfig,
|
|
14
|
+
Language,
|
|
40
15
|
LocalizedI18nConfig,
|
|
41
16
|
} from "./config";
|
|
17
|
+
// Utils
|
|
18
|
+
export type { FrakContext } from "./context";
|
|
42
19
|
export type {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} from "./
|
|
20
|
+
ClientLifecycleEvent,
|
|
21
|
+
IFrameLifecycleEvent,
|
|
22
|
+
} from "./lifecycle";
|
|
23
|
+
export type { IFrameRpcSchema } from "./rpc";
|
|
47
24
|
// Modal related
|
|
48
25
|
export type {
|
|
49
|
-
ModalStepTypes,
|
|
50
|
-
ModalRpcStepsInput,
|
|
51
|
-
ModalRpcStepsResultType,
|
|
52
26
|
DisplayModalParamsType,
|
|
53
27
|
ModalRpcMetadata,
|
|
28
|
+
ModalRpcStepsInput,
|
|
29
|
+
ModalRpcStepsResultType,
|
|
30
|
+
ModalStepTypes,
|
|
54
31
|
} from "./rpc/displayModal";
|
|
55
32
|
export type {
|
|
56
|
-
|
|
33
|
+
DisplayEmbeddedWalletParamsType,
|
|
34
|
+
DisplayEmbeddedWalletResultType,
|
|
35
|
+
EmbeddedViewActionReferred,
|
|
36
|
+
EmbeddedViewActionSharing,
|
|
37
|
+
LoggedInEmbeddedView,
|
|
38
|
+
LoggedOutEmbeddedView,
|
|
39
|
+
} from "./rpc/embedded";
|
|
40
|
+
export type {
|
|
41
|
+
PreparedInteraction,
|
|
42
|
+
SendInteractionParamsType,
|
|
43
|
+
SendInteractionReturnType,
|
|
44
|
+
} from "./rpc/interaction";
|
|
45
|
+
export type {
|
|
46
|
+
FinalActionType,
|
|
47
|
+
FinalModalStepType,
|
|
57
48
|
LoginModalStepType,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
SendTransactionTxType,
|
|
49
|
+
ModalStepMetadata,
|
|
50
|
+
OpenInteractionSessionModalStepType,
|
|
51
|
+
OpenInteractionSessionReturnType,
|
|
62
52
|
SendTransactionModalStepType,
|
|
63
53
|
SendTransactionReturnType,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
SendTransactionTxType,
|
|
55
|
+
SiweAuthenticateModalStepType,
|
|
56
|
+
SiweAuthenticateReturnType,
|
|
57
|
+
SiweAuthenticationParams,
|
|
68
58
|
} from "./rpc/modal";
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
export type {
|
|
60
|
+
GetProductInformationReturnType,
|
|
61
|
+
TokenAmountType,
|
|
62
|
+
} from "./rpc/productInformation";
|
|
63
|
+
export type {
|
|
64
|
+
OpenSsoParamsType,
|
|
65
|
+
OpenSsoReturnType,
|
|
66
|
+
PrepareSsoParamsType,
|
|
67
|
+
PrepareSsoReturnType,
|
|
68
|
+
SsoMetadata,
|
|
69
|
+
} from "./rpc/sso";
|
|
70
|
+
export type { WalletStatusReturnType } from "./rpc/walletStatus";
|
|
71
|
+
export type { FrakLifecycleEvent, IFrameTransport } from "./transport";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
FinalActionType,
|
|
3
|
+
FinalModalStepType,
|
|
4
|
+
} from "./final";
|
|
5
|
+
export type { ModalStepMetadata } from "./generic";
|
|
1
6
|
export type { LoginModalStepType } from "./login";
|
|
7
|
+
export type {
|
|
8
|
+
OpenInteractionSessionModalStepType,
|
|
9
|
+
OpenInteractionSessionReturnType,
|
|
10
|
+
} from "./openSession";
|
|
2
11
|
export type {
|
|
3
12
|
SiweAuthenticateModalStepType,
|
|
4
|
-
SiweAuthenticationParams,
|
|
5
13
|
SiweAuthenticateReturnType,
|
|
14
|
+
SiweAuthenticationParams,
|
|
6
15
|
} from "./siweAuthenticate";
|
|
7
16
|
export type {
|
|
8
17
|
SendTransactionModalStepType,
|
|
9
|
-
SendTransactionTxType,
|
|
10
18
|
SendTransactionReturnType,
|
|
19
|
+
SendTransactionTxType,
|
|
11
20
|
} from "./transaction";
|
|
12
|
-
export type {
|
|
13
|
-
OpenInteractionSessionReturnType,
|
|
14
|
-
OpenInteractionSessionModalStepType,
|
|
15
|
-
} from "./openSession";
|
|
16
|
-
export type { ModalStepMetadata } from "./generic";
|
|
17
|
-
export type {
|
|
18
|
-
FinalModalStepType,
|
|
19
|
-
FinalActionType,
|
|
20
|
-
} from "./final";
|
package/src/utils/FrakContext.ts
CHANGED
|
@@ -67,7 +67,10 @@ function parse({ url }: { url: string }) {
|
|
|
67
67
|
function update({
|
|
68
68
|
url,
|
|
69
69
|
context,
|
|
70
|
-
}: {
|
|
70
|
+
}: {
|
|
71
|
+
url?: string;
|
|
72
|
+
context: Partial<FrakContext>;
|
|
73
|
+
}) {
|
|
71
74
|
if (!url) return null;
|
|
72
75
|
|
|
73
76
|
// Parse the current context
|
|
@@ -111,7 +114,10 @@ function remove(url: string) {
|
|
|
111
114
|
function replaceUrl({
|
|
112
115
|
url: baseUrl,
|
|
113
116
|
context,
|
|
114
|
-
}: {
|
|
117
|
+
}: {
|
|
118
|
+
url?: string;
|
|
119
|
+
context: Partial<FrakContext> | null;
|
|
120
|
+
}) {
|
|
115
121
|
// If no window here early exit
|
|
116
122
|
if (!window.location?.href || typeof window === "undefined") {
|
|
117
123
|
console.error("No window found, can't update context");
|
|
@@ -30,9 +30,10 @@ export const baseIframeProps = {
|
|
|
30
30
|
export function createIframe({
|
|
31
31
|
walletBaseUrl,
|
|
32
32
|
config,
|
|
33
|
-
}: {
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
}: {
|
|
34
|
+
walletBaseUrl?: string;
|
|
35
|
+
config?: FrakWalletSdkConfig;
|
|
36
|
+
}): Promise<HTMLIFrameElement | undefined> {
|
|
36
37
|
// Check if the iframe is already created
|
|
37
38
|
const alreadyCreatedIFrame = document.querySelector("#frak-wallet");
|
|
38
39
|
|
package/src/utils/index.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
baseIframeProps,
|
|
4
|
-
findIframeInOpener,
|
|
5
|
-
} from "./iframeHelper";
|
|
1
|
+
export { Deferred } from "@frak-labs/frame-connector";
|
|
2
|
+
export { base64urlDecode, base64urlEncode } from "./compression/b64";
|
|
6
3
|
export { compressJsonToB64 } from "./compression/compress";
|
|
7
4
|
export { decompressJsonFromB64 } from "./compression/decompress";
|
|
8
|
-
export { base64urlDecode, base64urlEncode } from "./compression/b64";
|
|
9
5
|
export { FrakContextManager } from "./FrakContext";
|
|
6
|
+
export { formatAmount } from "./formatAmount";
|
|
7
|
+
export { getCurrencyAmountKey } from "./getCurrencyAmountKey";
|
|
10
8
|
export { getSupportedCurrency } from "./getSupportedCurrency";
|
|
11
9
|
export { getSupportedLocale } from "./getSupportedLocale";
|
|
12
|
-
export { getCurrencyAmountKey } from "./getCurrencyAmountKey";
|
|
13
|
-
export { formatAmount } from "./formatAmount";
|
|
14
|
-
export { trackEvent } from "./trackEvent";
|
|
15
|
-
export { Deferred } from "@frak-labs/frame-connector";
|
|
16
10
|
export {
|
|
17
|
-
|
|
11
|
+
baseIframeProps,
|
|
12
|
+
createIframe,
|
|
13
|
+
findIframeInOpener,
|
|
14
|
+
} from "./iframeHelper";
|
|
15
|
+
export {
|
|
16
|
+
type AppSpecificSsoMetadata,
|
|
18
17
|
type CompressedSsoData,
|
|
19
18
|
type FullSsoParams,
|
|
20
|
-
|
|
19
|
+
generateSsoUrl,
|
|
21
20
|
} from "./sso";
|
|
21
|
+
export { trackEvent } from "./trackEvent";
|