Skip to content

Proper configuration is crucial for the Wallet SDK to function correctly in your application. This guide will walk you through the configuration options and how to set them up.

The Wallet SDK uses a configuration object to set up its behavior. Here’s the structure of the FrakWalletSdkConfig object:

type
type Currency = "eur" | "usd" | "gbp"
Currency
= "eur" | "usd" | "gbp";
type
type Language = "fr" | "en"
Language
= "fr" | "en";
// biome-ignore lint/correctness/noUnusedVariables: Documentation snippet for user reference
type
type FrakWalletSdkConfig = {
readonly walletUrl?: string | undefined;
readonly metadata: {
name?: string;
merchantId?: string;
lang?: Language;
currency?: Currency;
logoUrl?: string;
homepageLink?: string;
};
... 4 more ...;
readonly preload?: ("modal" | "sharing")[] | undefined;
}
FrakWalletSdkConfig
=
type Readonly<T> = { readonly [P in keyof T]: T[P]; }

Make all properties in T readonly

Readonly
<{
/**
* The Frak wallet url
* @defaultValue "https://wallet.frak.id"
*/
walletUrl?: string | undefined

The Frak wallet url

@defaultValue"https://wallet.frak.id"

walletUrl
?: string;
/**
* Some metadata about your implementation of the Frak SDK
*/
metadata: {
name?: string;
merchantId?: string;
lang?: Language;
currency?: Currency;
logoUrl?: string;
homepageLink?: string;
}

Some metadata about your implementation of the Frak SDK

metadata
: {
/**
* Your application name (will be displayed in a few modals and in SSO)
*/
name?: string | undefined

Your application name (will be displayed in a few modals and in SSO)

name
?: string;
/**
* Your merchant ID from the Frak dashboard (UUID format)
* Used for referral tracking and analytics
* If not provided, will be auto-fetched from the backend using your domain
*/
merchantId?: string | undefined

Your merchant ID from the Frak dashboard (UUID format) Used for referral tracking and analytics If not provided, will be auto-fetched from the backend using your domain

merchantId
?: string;
/**
* Language to display in the modal
* If undefined, will default to the browser language
*/
lang?: Language | undefined

Language to display in the modal If undefined, will default to the browser language

lang
?:
type Language = "fr" | "en"
Language
;
/**
* The currency to display in the modal
* @defaultValue `"eur"`
*/
currency?: Currency | undefined

The currency to display in the modal

@defaultValue"eur"

currency
?:
type Currency = "eur" | "usd" | "gbp"
Currency
;
/**
* The logo URL that will be displayed in a few components
*/
logoUrl?: string | undefined

The logo URL that will be displayed in a few components

logoUrl
?: string;
/**
* The homepage link that could be displayed in a few components
*/
homepageLink?: string | undefined

The homepage link that could be displayed in a few components

homepageLink
?: string;
};
/**
* Some customization for the modal
*/
customizations?: {
css?: `${string}.css`;
i18n?: Record<Language, {
[key: string]: string;
}> | {
[key: string]: string;
};
} | undefined

Some customization for the modal

customizations
?: {
/**
* Custom CSS styles to apply to the modals and components
*/
css?: `${string}.css` | undefined

Custom CSS styles to apply to the modals and components

css
?: `${string}.css`;
/**
* Custom i18n configuration for the modal
* See [i18next json format](https://www.i18next.com/misc/json-format#i18next-json-v4)
*
* Available context variables
* - `{{ productName }}` : The name of your website (`metadata.name`)
* - `{{ productOrigin }}` : The origin url of your website
* - `{{ estimatedReward }}` : The estimated reward for the user
*
* Can be a single language config or a multi-language config
*
* @example
* // Multi-language config
* {
* fr: {
* "sdk.modal.title": "Titre de modal",
* "sdk.modal.description": "Description avec {{ estimatedReward }} de gains",
* },
* en: {
* "sdk.modal.title": "Modal title",
* }
* }
*
* @example
* // Single-language config
* {
* "sdk.modal.title": "Modal title",
* "sdk.modal.description": "Description with {{ estimatedReward }} of earnings",
* }
*/
i18n?: Record<Language, {
[key: string]: string;
}> | {
[key: string]: string;
} | undefined

Custom i18n configuration for the modal See i18next json format

Available context variables

  • {{ productName }} : The name of your website (metadata.name)
  • {{ productOrigin }} : The origin url of your website
  • {{ estimatedReward }} : The estimated reward for the user

Can be a single language config or a multi-language config

@example // Multi-language config { fr: { "sdk.modal.title": "Titre de modal", "sdk.modal.description": "Description avec {{ estimatedReward }} de gains", }, en: { "sdk.modal.title": "Modal title", } }

@example // Single-language config { "sdk.modal.title": "Modal title", "sdk.modal.description": "Description with {{ estimatedReward }} of earnings", }

i18n
?:
|
type Record<K extends keyof any, T> = { [P in K]: T; }

Construct a type with a set of properties K of type T

Record
<
type Language = "fr" | "en"
Language
, { [
key: string
key
: string]: string }>
| { [
key: string
key
: string]: string };
};
/**
* The domain name of your application
* @defaultValue window.location.host
*/
domain?: string | undefined

The domain name of your application

@defaultValuewindow.location.host

domain
?: string;
/**
* Wait for backend config before rendering components.
* When true (default), components show a spinner until backend config is resolved.
* When false, components render immediately with SDK static config / HTML attributes.
* @defaultValue true
*/
waitForBackendConfig?: boolean | undefined

Wait for backend config before rendering components. When true (default), components show a spinner until backend config is resolved. When false, components render immediately with SDK static config / HTML attributes.

@defaultValuetrue

waitForBackendConfig
?: boolean;
/**
* Default attribution params (UTM / via / ref) appended to outbound sharing URLs.
* Per-call `displaySharingPage` overrides win, then backend config, then this default.
* `utmContent` is intentionally excluded (it is per-content, never a merchant-wide default).
*/
attribution?: {
utmSource?: string;
utmMedium?: string;
utmCampaign?: string;
utmTerm?: string;
via?: string;
ref?: string;
} | undefined

Default attribution params (UTM / via / ref) appended to outbound sharing URLs. Per-call displaySharingPage overrides win, then backend config, then this default. utmContent is intentionally excluded (it is per-content, never a merchant-wide default).

attribution
?: {
utmSource?: string | undefined
utmSource
?: string;
utmMedium?: string | undefined
utmMedium
?: string;
utmCampaign?: string | undefined
utmCampaign
?: string;
utmTerm?: string | undefined
utmTerm
?: string;
via?: string | undefined
via
?: string;
ref?: string | undefined
ref
?: string;
};
/**
* Preload specific UI views inside the listener iframe for better UX.
* @defaultValue ["sharing"]
*/
preload?: ("modal" | "sharing")[] | undefined

Preload specific UI views inside the listener iframe for better UX.

@defaultValue["sharing"]

preload
?: ("modal" | "sharing")[];
}>;

Let’s break down each property:

This is the URL of the Frak Wallet service. Use one of the following values:

  • Production: "https://wallet.frak.id"
  • Development: "https://wallet-dev.frak.id"

This object contains metadata about your application:

  • name (optional): The name of your application. Displayed in modals and SSO pages.
  • merchantId (optional): Your merchant ID from the Frak dashboard (UUID format). Used for referral tracking and analytics. If not provided, it will be auto-fetched from the backend using your domain.
  • lang (optional): The display language ("en" or "fr"). Defaults to the browser language.
  • currency (optional): The display currency ("eur", "usd", or "gbp"). Defaults to "eur".
  • logoUrl (optional): Logo URL displayed in modals and a few components.
  • homepageLink (optional): Link to your homepage, used in SSO pages and some components.

This object contains customization options for the displayed Frak elements:

  • css (optional): A URL to a CSS file (must end with .css) that styles the Frak Wallet interface when displayed in your application.
  • i18n (optional): An object containing text overrides for SDK components. Can be a single-language config or a multi-language config keyed by language code.

The domain of your application. This is used to identify your application in the Frak ecosystem.

Controls whether components wait for the backend-driven configuration to be resolved before rendering.

  • true (default): Components show a loading spinner until backend config is resolved.
  • false: Components render immediately with local config and HTML attributes.

Default attribution parameters (utmSource, utmMedium, utmCampaign, utmTerm, via, ref) appended to outbound sharing URLs. Per-call displaySharingPage overrides take precedence, then backend config, then this SDK-level default. utmContent is intentionally excluded, as it is per-content rather than a merchant-wide default.

UI views to preload inside the listener iframe for a snappier first display. Accepts an array of "modal" and/or "sharing".

Here’s an example of a complete configuration object:

import type {
import FrakWalletSdkConfig
FrakWalletSdkConfig
} from '@frak-labs/core-sdk';
const
const frakConfig: FrakWalletSdkConfig
frakConfig
:
import FrakWalletSdkConfig
FrakWalletSdkConfig
= {
walletUrl: string
walletUrl
: "https://wallet.frak.id",
metadata: {
name: string;
lang: string;
currency: string;
logoUrl: string;
homepageLink: string;
}
metadata
: {
name: string
name
: "My Awesome dApp",
lang: string
lang
: "en",
currency: string
currency
: "usd",
logoUrl: string
logoUrl
: "https://my-app.com/logo.png",
homepageLink: string
homepageLink
: "https://my-app.com",
},
customizations: {
css: string;
i18n: {
en: {
"sdk.modal.title": string;
};
fr: {
"sdk.modal.title": string;
"sharing.title": string;
};
};
}
customizations
: {
css: string
css
: "https://my-app.com/frak-styles.css",
i18n: {
en: {
"sdk.modal.title": string;
};
fr: {
"sdk.modal.title": string;
"sharing.title": string;
};
}
i18n
: {
en: {
"sdk.modal.title": string;
}
en
: {
"sdk.modal.title": "Welcome!",
},
fr: {
"sdk.modal.title": string;
"sharing.title": string;
}
fr
: {
"sdk.modal.title": "Bienvenue !",
"sharing.title": "Partage ce produit!",
}
}
},
domain: string
domain
: "my-app.com",
};

How you use this configuration depends on whether you’re using React or vanilla JavaScript:

In a React application, use the FrakConfigProvider to provide this configuration to your app:

import {
import FrakConfigProvider
FrakConfigProvider
,
import FrakIFrameClientProvider
FrakIFrameClientProvider
} from '@frak-labs/react-sdk';
const
const frakConfig: {
metadata: {
name: string;
};
}
frakConfig
= {
metadata: {
name: string;
}
metadata
: {
name: string
name
: "My Awesome dApp",
},
};
function
function App(): any
App
() {
return (
<
import FrakConfigProvider
FrakConfigProvider
config: {
metadata: {
name: string;
};
}
config
={
const frakConfig: {
metadata: {
name: string;
};
}
frakConfig
}>
<
import FrakIFrameClientProvider
FrakIFrameClientProvider
>
{/* Your app components */}
</
import FrakIFrameClientProvider
FrakIFrameClientProvider
>
</
import FrakConfigProvider
FrakConfigProvider
>
);
}

In a vanilla JavaScript application, pass this configuration when creating a Frak client:

import {
import createIFrameFrakClient
createIFrameFrakClient
,
import createIframe
createIframe
} from '@frak-labs/core-sdk';
const
const frakConfig: {
metadata: {
name: string;
};
}
frakConfig
= {
metadata: {
name: string;
}
metadata
: {
name: string
name
: "My Awesome dApp",
},
};
const
const iframe: any
iframe
=
import createIframe
createIframe
({
config: {
metadata: {
name: string;
};
}
config
:
const frakConfig: {
metadata: {
name: string;
};
}
frakConfig
});
const
const client: any
client
= await
import createIFrameFrakClient
createIFrameFrakClient
({
config: {
metadata: {
name: string;
};
}
config
:
const frakConfig: {
metadata: {
name: string;
};
}
frakConfig
,
iframe: any
iframe
});
  1. Environment-based Configuration: Consider using different configurations for development and production environments. This allows you to use the development Frak Wallet during testing.

  2. Secure CSS: If you’re providing a custom CSS file, ensure it’s served over HTTPS to prevent security issues.

  3. Domain Consistency: If you provide a domain, make sure it matches the actual domain where your application is hosted. Mismatches can lead to authentication issues.

  4. Iframe Creation: Always use the createIframe helper function provided by the SDK to create the iframe. This ensures proper setup and compatibility.

By properly configuring the Wallet SDK, you ensure that it can communicate effectively with the Frak Wallet and provide a seamless experience for your users.