@swype-org/react-sdk 0.1.128 → 0.1.129
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/index.cjs +17 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7161,6 +7161,20 @@ function SwypePaymentInner({
|
|
|
7161
7161
|
return;
|
|
7162
7162
|
}
|
|
7163
7163
|
if (initializedSelectSourceActionRef.current === pendingSelectSourceAction.id) return;
|
|
7164
|
+
const options = pendingSelectSourceAction.metadata?.options ?? [];
|
|
7165
|
+
if (pendingTokenAuthRef.current) {
|
|
7166
|
+
const { tokenAddress, chainId } = pendingTokenAuthRef.current;
|
|
7167
|
+
const chainIdHex = `0x${chainId.toString(16)}`;
|
|
7168
|
+
const match = options.find(
|
|
7169
|
+
(opt) => opt.tokenAddress.toLowerCase() === tokenAddress.toLowerCase() && opt.chainId.toLowerCase() === chainIdHex.toLowerCase()
|
|
7170
|
+
);
|
|
7171
|
+
if (match) {
|
|
7172
|
+
setSelectSourceChainName(match.chainName);
|
|
7173
|
+
setSelectSourceTokenSymbol(match.tokenSymbol);
|
|
7174
|
+
initializedSelectSourceActionRef.current = pendingSelectSourceAction.id;
|
|
7175
|
+
return;
|
|
7176
|
+
}
|
|
7177
|
+
}
|
|
7164
7178
|
const hasRecommended = !!selectSourceRecommended && selectSourceChoices.some(
|
|
7165
7179
|
(chain) => chain.chainName === selectSourceRecommended.chainName && chain.tokens.some((t) => t.tokenSymbol === selectSourceRecommended.tokenSymbol)
|
|
7166
7180
|
);
|
|
@@ -7178,37 +7192,13 @@ function SwypePaymentInner({
|
|
|
7178
7192
|
}, [pendingSelectSourceAction, selectSourceChoices, selectSourceRecommended]);
|
|
7179
7193
|
react.useEffect(() => {
|
|
7180
7194
|
if (pendingSelectSourceAction && (state.step === "processing" || state.step === "open-wallet" || state.step === "setup-status")) {
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
if (recommended) {
|
|
7184
|
-
authExecutor.resolveSelectSource(recommended);
|
|
7185
|
-
} else {
|
|
7186
|
-
authExecutor.resolveSelectSource({ chainName: "Base", tokenSymbol: "USDC" });
|
|
7187
|
-
}
|
|
7188
|
-
} else {
|
|
7189
|
-
preSelectSourceStepRef.current = state.step;
|
|
7190
|
-
dispatch({ type: "NAVIGATE", step: "select-source" });
|
|
7191
|
-
}
|
|
7195
|
+
preSelectSourceStepRef.current = state.step;
|
|
7196
|
+
dispatch({ type: "NAVIGATE", step: "select-source" });
|
|
7192
7197
|
} else if (!pendingSelectSourceAction && state.step === "select-source") {
|
|
7193
7198
|
dispatch({ type: "NAVIGATE", step: preSelectSourceStepRef.current ?? "processing" });
|
|
7194
7199
|
preSelectSourceStepRef.current = null;
|
|
7195
7200
|
}
|
|
7196
|
-
}, [pendingSelectSourceAction, state.step,
|
|
7197
|
-
react.useEffect(() => {
|
|
7198
|
-
if (!pendingSelectSourceAction || !pendingTokenAuthRef.current) return;
|
|
7199
|
-
const { tokenAddress, chainId } = pendingTokenAuthRef.current;
|
|
7200
|
-
const chainIdHex = `0x${chainId.toString(16)}`;
|
|
7201
|
-
const options = pendingSelectSourceAction.metadata?.options ?? [];
|
|
7202
|
-
const match = options.find(
|
|
7203
|
-
(opt) => opt.tokenAddress.toLowerCase() === tokenAddress.toLowerCase() && opt.chainId.toLowerCase() === chainIdHex.toLowerCase()
|
|
7204
|
-
);
|
|
7205
|
-
if (match) {
|
|
7206
|
-
authExecutor.resolveSelectSource({
|
|
7207
|
-
chainName: match.chainName,
|
|
7208
|
-
tokenSymbol: match.tokenSymbol
|
|
7209
|
-
});
|
|
7210
|
-
}
|
|
7211
|
-
}, [pendingSelectSourceAction, authExecutor]);
|
|
7201
|
+
}, [pendingSelectSourceAction, state.step, authExecutor]);
|
|
7212
7202
|
const pendingOneTapSetupAction = authExecutor.pendingOneTapSetup;
|
|
7213
7203
|
const preOneTapSetupStepRef = react.useRef(null);
|
|
7214
7204
|
react.useEffect(() => {
|