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

Staging #13

Merged
merged 14 commits into from
Sep 5, 2024
1 change: 0 additions & 1 deletion .env

This file was deleted.

2 changes: 2 additions & 0 deletions .env.mainnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_MIXPANEL_TOKEN=acbafd21a85654933cbb0332c5a6f4f8
NEXT_PUBLIC_ENV=mainnet
2 changes: 2 additions & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_MIXPANEL_TOKEN=''
NEXT_PUBLIC_ENV='staging
147 changes: 75 additions & 72 deletions .firebase/hosting.b3V0.cache

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"hosting": {
"ton-bridge": [
"ton-bridge"
],
"ton-bridge-staging": [
"ton-bridge-staging"
]
}
}
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/firebase-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Deploy to Firebase Hosting

on:
push:
branches: [staging]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
dispatch:
runs-on: ubuntu-latest

steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT }}
repository: oraichain/infra
event-type: firebase
client-payload: '{"ref": "${{ github.ref }}", "repo": "${{ github.repository }}", "node_version": "18", "target": "ton-bridge-staging", "env_file": ".env.staging"}'
130 changes: 65 additions & 65 deletions assets/icons/token.tsx

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions components/layout/connectButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import classNames from "classnames";
import { FC, useCallback, useEffect, useRef, useState } from "react";
import ConnectedInfo from "../connectedInfo";
import styles from "./index.module.scss";
import { Environment } from "@/constants/ton";

export type ConnectStatus =
| "init"
Expand Down Expand Up @@ -84,8 +85,8 @@ const ConnectButton: FC<{ fullWidth?: boolean }> = ({ fullWidth }) => {

window.Keplr = new Keplr(walletType);
setStorageKey("typeWallet", walletType);
await initClient();
const oraiAddr = await window.Keplr.getKeplrAddr();
await initClient(process.env.NEXT_PUBLIC_ENV as Environment);
const oraiAddr = await window.Keplr.getKeplrAddr("Oraichain");
handleSetOraiAddress({ oraiAddress: oraiAddr });
handleSetOraiWallet({ oraiWallet: walletType });
setStep(2);
Expand Down
8 changes: 3 additions & 5 deletions components/page/bridge/components/inputBridge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ArrowDownIcon } from "@/assets/icons/arrow";
import { SelectOptionIcon } from "@/assets/icons/network";
import SelectCommon from "@/components/commons/select";
import { AMOUNT_BALANCE_ENTRIES_UNIVERSAL_SWAP } from "@/constants/config";
import { TonNetwork } from "@/constants/ton";
import { Environment } from "@/constants/ton";
import {
OraichainTokenList,
OsmosisTokenList,
Expand Down Expand Up @@ -37,7 +37,7 @@ const InputBridge: FC<{
onChangeAmount?: (amount: number | undefined) => void;
amount: number;
token: any;
tonNetwork: TonNetwork;
tonNetwork: Environment;
setToken: Dispatch<any>;
txtSearch: string;
setTxtSearch: Dispatch<SetStateAction<string>>;
Expand Down Expand Up @@ -99,7 +99,7 @@ const InputBridge: FC<{
}

if (networkFrom === NetworkList["osmosis-1"].id)
networkList = OsmosisTokenList;
networkList = OsmosisTokenList(tonNetwork);

return (
<div
Expand Down Expand Up @@ -212,8 +212,6 @@ const InputBridge: FC<{
className={styles.tokenItem}
key={`token-${key}`}
onClick={() => {
console.log({ eerererere: e });

setToken(e);
setOpen(false);
}}
Expand Down
11 changes: 6 additions & 5 deletions components/page/bridge/hooks/useGetFee.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { TonNetwork } from "@/constants/ton";
import { network } from "@/constants/networks";
import { Environment } from "@/constants/ton";
import { getNetworkConfig } from "@/constants/networks";
import { TokenType, TonTokenList } from "@/constants/tokens";
import { useAuthOraiAddress } from "@/stores/authentication/selector";
import { BigDecimal, toDisplay } from "@oraichain/oraidex-common";
import { BigDecimal } from "@oraichain/oraidex-common";
import { TonbridgeBridgeClient } from "@oraichain/tonbridge-contracts-sdk";
import { useEffect, useState } from "react";

const useGetFee = ({ token }: { token: TokenType }) => {
const oraiAddress = useAuthOraiAddress();
const [bridgeFee, setBridgeFee] = useState(0);
const [tokenFee, setTokenFee] = useState(0);
const network = getNetworkConfig(Environment.Mainnet);

useEffect(() => {
(async () => {
try {
if (token) {
const tokenInTon = TonTokenList(TonNetwork.Mainnet).find(
const tokenInTon = TonTokenList(Environment.Mainnet).find(
(tk) => tk.coingeckoId === token.coingeckoId
);
if (!tokenInTon) {
Expand Down Expand Up @@ -56,7 +57,7 @@ const useGetFee = ({ token }: { token: TokenType }) => {
useEffect(() => {
(async () => {
if (token) {
const tokenInTon = TonTokenList(TonNetwork.Mainnet).find(
const tokenInTon = TonTokenList(Environment.Mainnet).find(
(tk) => tk.coingeckoId === token.coingeckoId
);
if (!tokenInTon) {
Expand Down
7 changes: 5 additions & 2 deletions components/page/bridge/hooks/useGetStateData.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { network } from "@/constants/networks";
import { getNetworkConfig } from "@/constants/networks";
import { TokenType } from "@/constants/tokens";
import { Environment } from "@/constants/ton";
import { useAuthOraiAddress } from "@/stores/authentication/selector";
import { TonbridgeBridgeClient } from "@oraichain/tonbridge-contracts-sdk";
import { useEffect, useState } from "react";

const env = process.env.NEXT_PUBLIC_ENV as Environment;

const useGetStateData = () => {
const oraiAddress = useAuthOraiAddress();
const [balances, setBalances] = useState([]);
Expand All @@ -12,7 +15,7 @@ const useGetStateData = () => {
const tonBridgeClient = new TonbridgeBridgeClient(
window.client,
oraiAddress,
network.CW_TON_BRIDGE
getNetworkConfig(env).CW_TON_BRIDGE
);

const config = await tonBridgeClient.channelStateData();
Expand Down
Loading