From f4ec58773c0d08c305b3e85a2ff61ca2c0e0152a Mon Sep 17 00:00:00 2001 From: Hanssen0 Date: Mon, 24 Jun 2024 17:26:55 +0800 Subject: [PATCH 1/2] feat(common): support local config for `runPopup` --- packages/common/src/sdk/popup.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/common/src/sdk/popup.ts b/packages/common/src/sdk/popup.ts index 6d9a6a0..935db82 100644 --- a/packages/common/src/sdk/popup.ts +++ b/packages/common/src/sdk/popup.ts @@ -1,6 +1,7 @@ /* eslint-disable prefer-const */ import type { AuthResponseData, + DappConfig, DappRequestType, SignCkbTxResponseData, SignCotaNFTResponseData, @@ -51,7 +52,7 @@ export const openPopup = (url: string = ''): Window | null => { ) } -interface PopupRerurnType { +export interface PopupRerurnType { [DappRequestType.Auth]: AuthResponseData [DappRequestType.SignMessage]: SignMessageResponseData [DappRequestType.SignEvm]: SignEvmTxResponseData @@ -72,7 +73,7 @@ interface PopupRerurnType { } export const runPopup = async ( - config: PopupConfigOptions + config: PopupConfigOptions & Partial ): Promise => new Promise((resolve, reject) => { if (isStandaloneBrowser()) { @@ -100,7 +101,7 @@ export const runPopup = async ( ) popupEventListener = (e: MessageEvent) => { - const { joyidAppURL } = getConfig() + const joyidAppURL = config.joyidAppURL ?? getConfig().joyidAppURL if (joyidAppURL == null) { throw new Error('joyidAppURL is not set in the config') } From 4c2a6a965c39d3df4d68422ad84e51cceed7efb3 Mon Sep 17 00:00:00 2001 From: Hanssen Date: Mon, 24 Jun 2024 18:51:53 +0800 Subject: [PATCH 2/2] Create wise-boxes-drop.md --- .changeset/wise-boxes-drop.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/wise-boxes-drop.md diff --git a/.changeset/wise-boxes-drop.md b/.changeset/wise-boxes-drop.md new file mode 100644 index 0000000..87e6e7c --- /dev/null +++ b/.changeset/wise-boxes-drop.md @@ -0,0 +1,5 @@ +--- +"@joyid/common": minor +--- + +feat(common): support local config for `runPopup`