Skip to content

Commit

Permalink
Update the attribution property
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-jake committed Oct 3, 2024
1 parent 960e67e commit f3a94d9
Showing 1 changed file with 15 additions and 37 deletions.
52 changes: 15 additions & 37 deletions packages/wallet-sdk/src/core/provider/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ export interface AppMetadata {
appChainIds: number[];
}

type PostOnboardingAction = 'none' | 'onramp' | 'magicspend';

type OnrampPrefillOptions = {
contractAddress?: string;
amount: string;
chainId: number;
};
type Attribution =
| {
dataSuffix: string;
auto: never;
}
| {
dataSuffix: never;
auto: boolean;
};

export type Preference = {
/**
Expand All @@ -60,38 +62,14 @@ export type Preference = {
*/
options: 'all' | 'smartWalletOnly' | 'eoaOnly';
/**
* @param postOnboardingAction
* @type {PostOnboardingAction}
* @description This option only applies to Coinbase Smart Wallet. Displays CTAs to the user based on the preference of the app.
* These CTAs are part of prebuilt UI components that are available to the Coinbase
* Smart Wallet.
*
* Possible values:
* - `none`: No action is recommended post-onboarding. (Default experience)
* - `onramp`: Recommends initiating the onramp flow, allowing users to prefill their account with an optional asset.
* - `magicspend`: Suggests linking the users retail Coinbase account for seamless transactions.
*/
postOnboardingAction?: PostOnboardingAction;
/**
* @param onrampPrefillOptions
* @type {OnrampPrefillOptions}
* @description This option only applies to Coinbase Smart Wallet. Requires `postOnboardingAction` to be set to `onramp`. When not configured,
* The onramp screen defaults to an asset selector with 0 as the initial amount.
*
* - Prefills the onramp flow with the specified asset, chain, and suggested amount, allowing users to prefill their account.
* - Ensure the asset and chain are supported by the onramp provider (e.g., Coinbase Pay - CBPay).
*
* See https://docs.cdp.coinbase.com/onramp/docs/layer2#available-assets for a list of supported assets and networks.
*/
onrampPrefillOptions?: OnrampPrefillOptions;
/**
* @param attributionDataSuffix
* @type {Hex}
* @param attribution
* @type {Attribution}
* @note Smart Wallet only
* @description This option only applies to Coinbase Smart Wallet. Data suffix to be appended to the initCode or executeBatch calldata
* Coinbase Smart Wallet expects a 4 byte hex string. If the suffix is not a 4 byte hex string, the Smart Wallet will not apply the data suffix.
* @description This option only applies to Coinbase Smart Wallet. When a valid data suffix is supplied, it is appended to the initCode and executeBatch calldata.
* Coinbase Smart Wallet expects a 4 byte hex string. If the data suffix is not a 4 byte hex string, the Smart Wallet will ignore the property. If auto is true,
* the Smart Wallet will generate a 4 byte hex string from the apps origin.
*/
attributionDataSuffix?: string;
attribution?: Attribution;
} & Record<string, unknown>;

export interface ConstructorOptions {
Expand Down

0 comments on commit f3a94d9

Please sign in to comment.