mirror of https://github.com/certusone/oyster.git
Merge branch 'main' of github.com:yamijuan/oyster into wallet-connect-2nd
This commit is contained in:
commit
27dc4cfb4c
|
@ -67,10 +67,6 @@ export const Transfer = () => {
|
||||||
|
|
||||||
const setAssetInformation = async (asset: string) => {
|
const setAssetInformation = async (asset: string) => {
|
||||||
setMintAddress(asset);
|
setMintAddress(asset);
|
||||||
setRequest({
|
|
||||||
...request,
|
|
||||||
asset: asset,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -86,20 +82,23 @@ export const Transfer = () => {
|
||||||
const from = A.chain;
|
const from = A.chain;
|
||||||
const toChain = B.chain;
|
const toChain = B.chain;
|
||||||
|
|
||||||
|
console.log(from);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const asset = request.asset;
|
const asset = mintAddress;
|
||||||
if (!asset || (asset === request?.info?.address && request.from === from && request.toChain === toChain)) {
|
if (!asset || (asset === request?.info?.address && request.from === from && request.toChain === toChain)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(from);
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
if (!provider || !accounts[0]) {
|
if (!provider || !accounts[0]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const bridgeAddress = programIds().wormhole.bridge;
|
const bridgeAddress = programIds().wormhole.bridge;
|
||||||
|
if (from === ASSET_CHAIN.Ethereum) {
|
||||||
if (request.from === ASSET_CHAIN.Solana) {
|
|
||||||
|
|
||||||
let signer = provider.getSigner();
|
let signer = provider.getSigner();
|
||||||
let e = WrappedAssetFactory.connect(asset, provider);
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -2,17 +2,13 @@ import React, {
|
||||||
createContext,
|
createContext,
|
||||||
FunctionComponent,
|
FunctionComponent,
|
||||||
useContext,
|
useContext,
|
||||||
useEffect,
|
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { Connection, PublicKey } from '@solana/web3.js';
|
|
||||||
import { SolanaBridge } from '../core';
|
import { SolanaBridge } from '../core';
|
||||||
import {
|
import {
|
||||||
useConnection,
|
useConnection,
|
||||||
useConnectionConfig,
|
useConnectionConfig,
|
||||||
} from '@oyster/common/dist/lib/contexts/connection';
|
} from '@oyster/common/dist/lib/contexts/connection';
|
||||||
import { utils } from '@oyster/common';
|
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);
|
export const BridgeContext = createContext<SolanaBridge | undefined>(undefined);
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,9 @@ import * as solanaWeb3 from '@solana/web3.js';
|
||||||
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
||||||
import BN from 'bn.js';
|
import BN from 'bn.js';
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import * as spl from '@solana/spl-token';
|
|
||||||
import { Token } from '@solana/spl-token';
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import * as BufferLayout from 'buffer-layout';
|
import * as BufferLayout from 'buffer-layout';
|
||||||
import * as bs58 from 'bs58';
|
import * as bs58 from 'bs58';
|
||||||
import { utils } from '@oyster/common';
|
|
||||||
|
|
||||||
export interface Lockup {
|
export interface Lockup {
|
||||||
lockupAddress: PublicKey;
|
lockupAddress: PublicKey;
|
||||||
|
|
|
@ -11,9 +11,6 @@ import {
|
||||||
} from '@oyster/common';
|
} from '@oyster/common';
|
||||||
import { WalletAdapter } from '@solana/wallet-base';
|
import { WalletAdapter } from '@solana/wallet-base';
|
||||||
import { ethers } from 'ethers';
|
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 { WormholeFactory } from '../../../contracts/WormholeFactory';
|
||||||
import { bridgeAuthorityKey } from './../helpers';
|
import { bridgeAuthorityKey } from './../helpers';
|
||||||
import { Connection, PublicKey, SystemProgram } from '@solana/web3.js';
|
import { Connection, PublicKey, SystemProgram } from '@solana/web3.js';
|
||||||
|
|
Loading…
Reference in New Issue