Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to protocol v2.3.0 #55

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 57 additions & 57 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@bosonprotocol/react-kit": "^0.19.1-alpha.2",
"@bosonprotocol/react-kit": "^0.20.0-alpha.6",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
Expand Down
5 changes: 4 additions & 1 deletion src/components/widgets/finance/Finance.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { FinanceWidget } from "@bosonprotocol/react-kit";
import { ConfigId, FinanceWidget } from "@bosonprotocol/react-kit";
import { useSearchParams } from "react-router-dom";

import { CONFIG } from "../../../config";
import { getDefaultConfigId } from "../../../utils";

export const financePath = "/finance";
export function Finance() {
const [searchParams] = useSearchParams();
const configId = (searchParams.get("configId") as ConfigId) || undefined;
const sellerId = searchParams.get("sellerId");
if (!sellerId) {
return <p>Missing 'sellerId' query param</p>;
Expand All @@ -15,6 +17,7 @@ export function Finance() {
<FinanceWidget
sellerId={sellerId}
envName={CONFIG.envName}
configId={configId || getDefaultConfigId(CONFIG.envName)}
metaTx={{
apiKey: CONFIG.metaTxApiKey as string,
apiIds: CONFIG.metaTxApiIds as string
Expand Down
4 changes: 4 additions & 0 deletions src/components/widgets/redeem/Redeem.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import {
ConfigId,
RedemptionBypassMode,
RedemptionWidget
} from "@bosonprotocol/react-kit";
import { useSearchParams } from "react-router-dom";

import { CONFIG } from "../../../config";
import { getDefaultConfigId } from "../../../utils";

export const redeemPath = "/redeem";
export function Redeem() {
const [searchParams] = useSearchParams();
const configId = (searchParams.get("configId") as ConfigId) || undefined;
const exchangeId = searchParams.get("exchangeId") || undefined;
const bypassMode: RedemptionBypassMode = checkBypassMode(
searchParams.get("bypassMode") || undefined
Expand All @@ -32,6 +35,7 @@ export function Redeem() {
<RedemptionWidget
exchangeId={exchangeId}
envName={CONFIG.envName}
configId={configId || getDefaultConfigId(CONFIG.envName)}
metaTx={{
apiKey: CONFIG.metaTxApiKey as string,
apiIds: CONFIG.metaTxApiIds as string
Expand Down
12 changes: 12 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {
ConfigId,
EnvironmentType,
getEnvConfigs
} from "@bosonprotocol/react-kit";

export function getDefaultConfigId(envName: EnvironmentType): ConfigId {
if (getEnvConfigs(envName).length === 0) {
throw new Error(`No config found for envNAme '${envName}'`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new Error(`No config found for envNAme '${envName}'`);
throw new Error(`No config found for envName '${envName}'`);

}
return getEnvConfigs(envName)[0].configId;
}