Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:graz-sh/graz into kjivani/react-quer…
Browse files Browse the repository at this point in the history
…y-update
  • Loading branch information
karancoder committed Dec 10, 2024
2 parents 81d774c + 1cbf5a7 commit 99a026c
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/docs @codingki
/example @codingki @grikomsn @joshuanatanielnm
/packages/graz @codingki @grikomsn
/example @codingki @joshuanatanielnm
/packages/graz @codingki
/packages/grazkit-chakra @grikomsn @joshuanatanielnm
10 changes: 7 additions & 3 deletions packages/graz/src/actions/wallet/wallet-connect/clot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ export const getWCClot = (): Wallet => {
walletType: WalletType.WC_CLOT_MOBILE,
formatNativeUrl: (appUrl, wcUri, os) => {
const plainAppUrl = appUrl.replaceAll("/", "").replaceAll(":", "");
const encoded = encodeURIComponent(wcUri);
const encoded = wcUri && encodeURIComponent(wcUri);
switch (os) {
case "ios":
case "ios": {
if (!encoded) return `${plainAppUrl}://wcV2`;
return `${plainAppUrl}://wcV2?${encoded}`;
default:
}
default: {
if (!encoded) return `${plainAppUrl}://wc`;
return `${plainAppUrl}://wc?uri=${encoded}`;
}
}
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const getWCCosmostation = (): Wallet => {
walletType: WalletType.WC_COSMOSTATION_MOBILE,
formatNativeUrl: (appUrl, wcUri, _os) => {
const plainAppUrl = appUrl.replaceAll("/", "").replaceAll(":", "");
if (!wcUri) return `${plainAppUrl}://wc`;
return `${plainAppUrl}://wc?${wcUri}`;
},
};
Expand Down
16 changes: 4 additions & 12 deletions packages/graz/src/actions/wallet/wallet-connect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,12 @@ export const getWalletConnect = (params?: GetWalletConnectParams): Wallet => {
const { appUrl, formatNativeUrl } = params;
if (!isMobile()) return;
if (isAndroid()) {
if (!wcUri) {
window.open(appUrl.mobile.android, "_self", "noreferrer noopener");
} else {
const href = formatNativeUrl(appUrl.mobile.android, wcUri, "android");
window.open(href, "_self", "noreferrer noopener");
}
const href = formatNativeUrl(appUrl.mobile.android, wcUri, "android");
window.open(href, "_self", "noreferrer noopener");
}
if (isIos()) {
if (!wcUri) {
window.open(appUrl.mobile.ios, "_self", "noreferrer noopener");
} else {
const href = formatNativeUrl(appUrl.mobile.ios, wcUri, "ios");
window.open(href, "_self", "noreferrer noopener");
}
const href = formatNativeUrl(appUrl.mobile.ios, wcUri, "ios");
window.open(href, "_self", "noreferrer noopener");
}
};

Expand Down
14 changes: 10 additions & 4 deletions packages/graz/src/actions/wallet/wallet-connect/keplr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ export const getWCKeplr = (): Wallet => {
walletType: WalletType.WC_KEPLR_MOBILE,
formatNativeUrl: (appUrl, wcUri, os) => {
const plainAppUrl = appUrl.replaceAll("/", "").replaceAll(":", "");
const encoded = encodeURIComponent(wcUri);
const encoded = wcUri && encodeURIComponent(wcUri);
switch (os) {
case "ios":
case "ios": {
if (!encoded) return `${plainAppUrl}://wcV2`;
return `${plainAppUrl}://wcV2?${encoded}`;
case "android":
}
case "android": {
if (!encoded) return `${plainAppUrl}://wcV2#Intent;package=com.chainapsis.keplr;scheme=keplrwallet;end;`;
return `${plainAppUrl}://wcV2?${encoded}#Intent;package=com.chainapsis.keplr;scheme=keplrwallet;end;`;
default:
}
default: {
if (!encoded) return `${plainAppUrl}://wc`;
return `${plainAppUrl}://wc?uri=${encoded}`;
}
}
},
};
Expand Down
14 changes: 10 additions & 4 deletions packages/graz/src/actions/wallet/wallet-connect/leap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ export const getWCLeap = (): Wallet => {
walletType: WalletType.WC_LEAP_MOBILE,
formatNativeUrl: (appUrl, wcUri, os) => {
const plainAppUrl = appUrl.replaceAll("/", "").replaceAll(":", "");
const encoded = encodeURIComponent(wcUri);
const encoded = wcUri && encodeURIComponent(wcUri);
switch (os) {
case "ios":
case "ios": {
if (!encoded) return `${plainAppUrl}://wcV2`;
return `${plainAppUrl}://wcV2?${encoded}`;
case "android":
}
case "android": {
if (!encoded) return `${plainAppUrl}://wcV2#Intent;package=io.leapwallet.cosmos;scheme=leapwallet;end;`;
return `${plainAppUrl}://wcV2?${encoded}#Intent;package=io.leapwallet.cosmos;scheme=leapwallet;end;`;
default:
}
default: {
if (!encoded) return `${plainAppUrl}://wc`;
return `${plainAppUrl}://wc?uri=${encoded}`;
}
}
},
};
Expand Down
2 changes: 1 addition & 1 deletion packages/graz/src/actions/wallet/wallet-connect/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export interface GetWalletConnectParams {
android: string;
};
};
formatNativeUrl: (appUrl: string, wcUri: string, os?: "android" | "ios") => string;
formatNativeUrl: (appUrl: string, wcUri?: string, os?: "android" | "ios") => string;
}
2 changes: 2 additions & 0 deletions packages/graz/src/types/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export type Wallet = Pick<
setDefaultOptions?: (options: KeplrIntereactionOptions) => void;
onAfterLoginSuccessful?: () => Promise<void>;
getKey: (chainId: string) => Promise<Key>;
signEthereum?: Keplr["signEthereum"];
experimentalSignEIP712CosmosTx_v0?: Keplr["experimentalSignEIP712CosmosTx_v0"];
};

export type SignDirectParams = Parameters<Wallet["signDirect"]>;
Expand Down

0 comments on commit 99a026c

Please sign in to comment.