Merge branch 'main' of github.com:yamijuan/oyster into wallet-connect-2nd

This commit is contained in:
juan 2021-03-19 13:38:31 -05:00
commit 27dc4cfb4c
4 changed files with 7 additions and 18 deletions

View File

@ -67,10 +67,6 @@ export const Transfer = () => {
const setAssetInformation = async (asset: string) => {
setMintAddress(asset);
setRequest({
...request,
asset: asset,
});
};
useEffect(() => {
@ -86,20 +82,23 @@ export const Transfer = () => {
const from = A.chain;
const toChain = B.chain;
console.log(from);
useEffect(() => {
const asset = request.asset;
const asset = mintAddress;
if (!asset || (asset === request?.info?.address && request.from === from && request.toChain === toChain)) {
return;
}
console.log(from);
(async () => {
if (!provider || !accounts[0]) {
return;
}
try {
const bridgeAddress = programIds().wormhole.bridge;
if (request.from === ASSET_CHAIN.Solana) {
if (from === ASSET_CHAIN.Ethereum) {
let signer = provider.getSigner();
let e = WrappedAssetFactory.connect(asset, provider);
@ -175,7 +174,7 @@ export const Transfer = () => {
});
}
})();
}, [request, from, toChain, provider, connected]);
}, [request, mintAddress, from, toChain, provider, accounts, connected]);
return (
<>

View File

@ -2,17 +2,13 @@ import React, {
createContext,
FunctionComponent,
useContext,
useEffect,
} from 'react';
import { Connection, PublicKey } from '@solana/web3.js';
import { SolanaBridge } from '../core';
import {
useConnection,
useConnectionConfig,
} from '@oyster/common/dist/lib/contexts/connection';
import { utils } from '@oyster/common';
import { MintLayout, TOKEN_PROGRAM_ID } from '@solana/spl-token';
import { WORMHOLE_PROGRAM_ID } from '../utils/ids';
export const BridgeContext = createContext<SolanaBridge | undefined>(undefined);

View File

@ -2,12 +2,9 @@ import * as solanaWeb3 from '@solana/web3.js';
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
import BN from 'bn.js';
import assert from 'assert';
import * as spl from '@solana/spl-token';
import { Token } from '@solana/spl-token';
// @ts-ignore
import * as BufferLayout from 'buffer-layout';
import * as bs58 from 'bs58';
import { utils } from '@oyster/common';
export interface Lockup {
lockupAddress: PublicKey;

View File

@ -11,9 +11,6 @@ import {
} from '@oyster/common';
import { WalletAdapter } from '@solana/wallet-base';
import { ethers } from 'ethers';
import { ASSET_CHAIN } from '../../../utils/assets';
import { BigNumber } from 'ethers/utils';
import { Erc20Factory } from '../../../contracts/Erc20Factory';
import { WormholeFactory } from '../../../contracts/WormholeFactory';
import { bridgeAuthorityKey } from './../helpers';
import { Connection, PublicKey, SystemProgram } from '@solana/web3.js';