Skip to content

Commit

Permalink
update defaults and config vars
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntVal committed Jul 16, 2024
1 parent d89f3ab commit 8f78003
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export const AbstraxionSignin = () => {
return;
}
try {
await window.okxwallet.keplr.enable("xion-testnet-1");
const okxAccount = await window.okxwallet.keplr.getKey("xion-testnet-1");
await window.okxwallet.keplr.enable(chainInfo.chainId);
const okxAccount = await window.okxwallet.keplr.getKey(chainInfo.chainId);
const authenticator = getHumanReadablePubkey(okxAccount.pubKey);
setConnectionType("okx");
localStorage.setItem("loginType", "okx");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ export function AddAuthenticatorsForm({
const encoder = new TextEncoder();
const signArbMessage = Buffer.from(encoder.encode(abstractAccount?.id));

await window.okxwallet.keplr.enable("xion-testnet-1");
const okxAccount = await window.okxwallet.keplr.getKey("xion-testnet-1");
await window.okxwallet.keplr.enable(chainInfo.chainId);
const okxAccount = await window.okxwallet.keplr.getKey(chainInfo.chainId);
const signArbRes = await window.okxwallet.keplr.signArbitrary(
chainInfo.chainId,
okxAccount.bech32Address,
Expand Down
12 changes: 7 additions & 5 deletions apps/abstraxion-dashboard/hooks/useAbstraxionSigningClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
AbstraxionContextProps,
} from "@/components/AbstraxionContext";
import { getKeplr, useOfflineSigners } from "graz";
import { testnetChainInfo } from "@burnt-labs/constants";
import { mainnetChainInfo } from "@burnt-labs/constants";
import { AAEthSigner } from "@burnt-labs/signers";
import { getEnvStringOrThrow } from "@/utils";

Expand Down Expand Up @@ -39,7 +39,7 @@ export const useAbstraxionSigningClient = () => {
alert("Please install the OKX wallet extension");
return;
}
await window.okxwallet.keplr.enable("xion-testnet-1");
await window.okxwallet.keplr.enable(chainInfo.chainId);
const signDataNew = Uint8Array.from(Object.values(signBytes));
return window.okxwallet.keplr.signArbitrary(chainId, account, signDataNew);
}
Expand Down Expand Up @@ -79,7 +79,9 @@ export const useAbstraxionSigningClient = () => {
break;
case "graz":
if (keplr) {
const offlineSigner = window.keplr.getOfflineSigner("xion-testnet-1");
const offlineSigner = window.keplr.getOfflineSigner(
chainInfo.chainId,
);
signer = new AADirectSigner(
offlineSigner,
abstractAccount.id,
Expand All @@ -96,7 +98,7 @@ export const useAbstraxionSigningClient = () => {
case "okx":
if (window.okxwallet) {
const okxOfflineSigner =
await window.okxwallet.keplr.getOfflineSigner("xion-testnet-1");
await window.okxwallet.keplr.getOfflineSigner(chainInfo.chainId);
signer = new AADirectSigner(
okxOfflineSigner,
abstractAccount.id,
Expand Down Expand Up @@ -134,7 +136,7 @@ export const useAbstraxionSigningClient = () => {

const abstractClient = await AAClient.connectWithSigner(
// Should be set in the context but defaulting here just in case.
chainInfo.rpc || testnetChainInfo.rpc,
chainInfo.rpc || mainnetChainInfo.rpc,
signer,
{
gasPrice: GasPrice.fromString("0uxion"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export const AbstraxionSignin = () => {
return;
}
try {
await window.okxwallet.keplr.enable("xion-testnet-1");
const okxAccount = await window.okxwallet.keplr.getKey("xion-testnet-1");
await window.okxwallet.keplr.enable(chainInfo.chainId);
const okxAccount = await window.okxwallet.keplr.getKey(chainInfo.chainId);
const authenticator = getHumanReadablePubkey(okxAccount.pubKey);
setConnectionType("okx");
localStorage.setItem("loginType", "okx");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
AbstraxionContextProps,
} from "../components/AbstraxionContext";
import { getKeplr, useOfflineSigners } from "graz";
import { testnetChainInfo } from "@burnt-labs/constants";
import { mainnetChainInfo } from "@burnt-labs/constants";
import { AAEthSigner } from "@burnt-labs/signers";
import { getEnvStringOrThrow } from "../utils";

Expand Down Expand Up @@ -39,7 +39,7 @@ export const useAbstraxionSigningClient = () => {
alert("Please install the OKX wallet extension");
return;
}
await window.okxwallet.keplr.enable("xion-testnet-1");
await window.okxwallet.keplr.enable(chainInfo.chainId);
const signDataNew = Uint8Array.from(Object.values(signBytes));
return window.okxwallet.keplr.signArbitrary(chainId, account, signDataNew);
}
Expand Down Expand Up @@ -95,7 +95,7 @@ export const useAbstraxionSigningClient = () => {
case "okx":
if (window.okxwallet) {
const okxOfflineSigner =
await window.okxwallet.keplr.getOfflineSigner("xion-testnet-1");
await window.okxwallet.keplr.getOfflineSigner(chainInfo.chainId);
signer = new AADirectSigner(
okxOfflineSigner,
abstractAccount.id,
Expand Down Expand Up @@ -133,7 +133,7 @@ export const useAbstraxionSigningClient = () => {

const abstractClient = await AAClient.connectWithSigner(
// Should be set in the context but defaulting here just in case.
chainInfo.rpc || testnetChainInfo.rpc,
chainInfo.rpc || mainnetChainInfo.rpc,
signer,
{
gasPrice: GasPrice.fromString("0uxion"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReactNode } from "react";
import { createContext, useEffect, useState } from "react";
import { testnetChainInfo } from "@burnt-labs/constants";
import { mainnetChainInfo } from "@burnt-labs/constants";
import { SignArbSecp256k1HdWallet } from "@burnt-labs/abstraxion-core";
import { abstraxionAuth } from "../Abstraxion";

Expand Down Expand Up @@ -43,8 +43,8 @@ export const AbstraxionContext = createContext<AbstraxionContextProps>(
export function AbstraxionContextProvider({
children,
contracts,
rpcUrl = testnetChainInfo.rpc,
restUrl = testnetChainInfo.rest,
rpcUrl = mainnetChainInfo.rpc,
restUrl = mainnetChainInfo.rest,
stake = false,
bank,
callbackUrl,
Expand Down
4 changes: 2 additions & 2 deletions packages/abstraxion/src/hooks/useAbstraxionSigningClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useContext, useEffect, useState } from "react";
import { testnetChainInfo } from "@burnt-labs/constants";
import { mainnetChainInfo } from "@burnt-labs/constants";
import { GasPrice } from "@cosmjs/stargate";
import {
GranteeSignerClient,
Expand Down Expand Up @@ -47,7 +47,7 @@ export const useAbstraxionSigningClient = (): {

const directClient = await GranteeSignerClient.connectWithSigner(
// Should be set in the context but defaulting here just in case
rpcUrl || testnetChainInfo.rpc,
rpcUrl || mainnetChainInfo.rpc,
abstraxionAccount,
{
gasPrice: GasPrice.fromString("0uxion"),
Expand Down
10 changes: 9 additions & 1 deletion packages/constants/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ const commonInfo: ChainInfo = {
features: ["cosmwasm"],
};

export const mainnetChainInfo: ChainInfo = {
...commonInfo,
rpc: "https://rpc.xion-mainnet-1.burnt.com:443",
rest: "https://api.xion-mainnet-1.burnt.com:443",
chainId: "xion-mainnet-1",
chainName: "XION Mainnet",
};

export const testnetChainInfo: ChainInfo = {
...commonInfo,
rpc: "https://testnet-rpc.xion-api.com:443",
Expand All @@ -93,7 +101,7 @@ const DASHBOARD_URLS = {
};

const REST_URLS = {
"xion-mainnet-1": "https://testnet-api.xion-api.com:443", // TODO: Update
"xion-mainnet-1": "https://api.xion-mainnet-1.burnt.com:443",
"xion-testnet-1": "https://testnet-api.xion-api.com:443",
};

Expand Down
3 changes: 2 additions & 1 deletion packages/signers/src/signers/direct-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export class AADirectSigner extends AASigner {
this.accountAuthenticatorIndex = accountAuthenticatorIndex;
this.signArbFn = signArbFn;
this.indexerUrl =
indexerUrl || "https://api.subquery.network/sq/burnt-labs/xion-indexer";
indexerUrl ||
"https://api.subquery.network/sq/burnt-labs/xion-mainnet-indexer";
}

async signDirect(
Expand Down
3 changes: 2 additions & 1 deletion packages/signers/src/signers/eth-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export class AAEthSigner extends AASigner {
this.accountAuthenticatorIndex = accountAuthenticatorIndex;
this.personalSign = personalSign;
this.indexerUrl =
indexerUrl || "https://api.subquery.network/sq/burnt-labs/xion-indexer";
indexerUrl ||
"https://api.subquery.network/sq/burnt-labs/xion-mainnet-indexer";
}

async signDirect(
Expand Down
5 changes: 3 additions & 2 deletions packages/signers/src/signers/jwt-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ export class AbstractAccountJWTSigner extends AASigner {
this.sessionToken = sessionToken;
this.accountAuthenticatorIndex = accountAuthenticatorIndex;
this.indexerUrl =
indexerUrl || "https://api.subquery.network/sq/burnt-labs/xion-indexer";
this.apiUrl = apiUrl || "https://aa.xion-testnet-1.burnt.com";
indexerUrl ||
"https://api.subquery.network/sq/burnt-labs/xion-mainnet-indexer";
this.apiUrl = apiUrl || "https://aa.xion-mainnet-1.burnt.com/"; // Double check. This is assumed endpoint
}

async getAccounts(): Promise<readonly AAccountData[]> {
Expand Down
4 changes: 3 additions & 1 deletion packages/signers/src/signers/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ let apolloClientInstance: ApolloClient<NormalizedCacheObject>;
export const getApolloClient = (url?: string) => {
if (!apolloClientInstance) {
apolloClientInstance = new ApolloClient({
uri: url || "https://api.subquery.network/sq/burnt-labs/xion-indexer",
uri:
url ||
"https://api.subquery.network/sq/burnt-labs/xion-mainnet-indexer",
cache: new InMemoryCache(),
assumeImmutableResults: true,
});
Expand Down

0 comments on commit 8f78003

Please sign in to comment.