Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseRFelix committed Jun 6, 2024
1 parent d1e2cff commit 9236db7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/types/src/autheticator-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export interface RawAuthenticator {
}

export interface RawNestedAuthenticator {
Config: string;
Type: AuthenticatorType;
config: string;
type: AuthenticatorType;
}

export interface MessageFilterAuthenticator {
Expand Down
22 changes: 11 additions & 11 deletions packages/utils/src/authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ export function parseNestedAuthenticator({
authenticator: RawNestedAuthenticator;
}): NestedAuthenticator {
try {
if (rawNestedAuthenticator.Type === "SignatureVerification") {
if (rawNestedAuthenticator.type === "SignatureVerification") {
return {
type: "SignatureVerification",
publicKey: rawNestedAuthenticator.Config,
publicKey: rawNestedAuthenticator.config,
};
}

if (rawNestedAuthenticator.Type === "CosmwasmAuthenticatorV1") {
if (rawNestedAuthenticator.type === "CosmwasmAuthenticatorV1") {
const parsedData: { contract: string; params: string } = JSON.parse(
Buffer.from(rawNestedAuthenticator.Config, "base64").toString("utf-8")
Buffer.from(rawNestedAuthenticator.config, "base64").toString("utf-8")
);
const parsedParams = JSON.parse(
Buffer.from(parsedData.params, "base64").toString("utf-8")
Expand All @@ -107,9 +107,9 @@ export function parseNestedAuthenticator({
} as CosmwasmAuthenticatorV1;
}

if (rawNestedAuthenticator.Type === "MessageFilter") {
if (rawNestedAuthenticator.type === "MessageFilter") {
const parsedData: { "@type": string } = JSON.parse(
Buffer.from(rawNestedAuthenticator.Config, "base64").toString("utf-8")
Buffer.from(rawNestedAuthenticator.config, "base64").toString("utf-8")
);
return {
type: "MessageFilter",
Expand All @@ -118,15 +118,15 @@ export function parseNestedAuthenticator({
}

if (
rawNestedAuthenticator.Type === "AnyOf" ||
rawNestedAuthenticator.Type === "AllOf"
rawNestedAuthenticator.type === "AnyOf" ||
rawNestedAuthenticator.type === "AllOf"
) {
const subAuthenticators: RawNestedAuthenticator[] = JSON.parse(
Buffer.from(rawNestedAuthenticator.Config, "base64").toString("utf-8")
Buffer.from(rawNestedAuthenticator.config, "base64").toString("utf-8")
);

return {
type: rawNestedAuthenticator.Type,
type: rawNestedAuthenticator.type,
subAuthenticators: subAuthenticators.map(
(subAuthenticator: RawNestedAuthenticator) => {
return parseNestedAuthenticator({
Expand All @@ -138,7 +138,7 @@ export function parseNestedAuthenticator({
}

throw new Error(
`Unknown nested authenticator type: ${rawNestedAuthenticator.Type}`
`Unknown nested authenticator type: ${rawNestedAuthenticator.type}`
);
} catch (error) {
console.error("Error parsing nested authenticator:", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const ProfileOneClickTradingSettings = ({
enabled: shouldFetchSessionAuthenticator,
cacheTime: 15_000, // 15 seconds
staleTime: 15_000, // 15 seconds
retry: false,
}
);

Expand Down

0 comments on commit 9236db7

Please sign in to comment.