passing token setup test
This commit is contained in:
parent
0a60d7aa4c
commit
732c1a0781
|
@ -110,7 +110,8 @@ export async function attest(src: string, target:string, address:string = null){
|
|||
address = srcDeployInfo.tokenAddress;
|
||||
}
|
||||
console.log(`Attesting ${address} from ${src} network onto ${target}`);
|
||||
|
||||
|
||||
setDefaultWasm("node");
|
||||
const tx = await attestFromSolana(
|
||||
connection,
|
||||
srcNetwork.bridgeAddress,
|
||||
|
@ -210,7 +211,7 @@ export async function createWrapped(src:string, target:string, vaa:string){
|
|||
const txid = await connection.sendRawTransaction(tx.serialize());
|
||||
console.log("TXID: ", txid);
|
||||
|
||||
await new Promise((r) => setTimeout(r, 5000)); // wait for blocks to advance before fetching new foreign address
|
||||
await new Promise((r) => setTimeout(r, 15000)); // wait for blocks to advance before fetching new foreign address
|
||||
const foreignAddress = await getForeignAssetSolana(
|
||||
connection,
|
||||
srcNetwork.tokenBridgeAddress,
|
||||
|
@ -220,6 +221,29 @@ export async function createWrapped(src:string, target:string, vaa:string){
|
|||
console.log(`${src} Network has new PortalWrappedToken for ${target} network at ${foreignAddress}`);
|
||||
}
|
||||
|
||||
export async function debug(){
|
||||
const src = "sol0";
|
||||
const target = 'evm0';
|
||||
const srcNetwork = config.networks[src];
|
||||
const targetNetwork = config.networks[target];
|
||||
const srcDeployInfo = JSON.parse(fs.readFileSync(`./deployinfo/${src}.deploy.json`).toString());
|
||||
const targetDeployInfo = JSON.parse(fs.readFileSync(`./deployinfo/${target}.deploy.json`).toString());
|
||||
const srcKey = anchor.web3.Keypair.fromSecretKey(Uint8Array.from(JSON.parse((fs.readFileSync(`keypairs/${src}.key`).toString())
|
||||
)));
|
||||
const connection = new anchor.web3.Connection(srcNetwork.rpc);
|
||||
|
||||
setDefaultWasm("node");
|
||||
await new Promise((r) => setTimeout(r, 20000)); // wait for blocks to advance before fetching new foreign address
|
||||
const foreignAddress = await getForeignAssetSolana(
|
||||
connection,
|
||||
srcNetwork.tokenBridgeAddress,
|
||||
targetNetwork.wormholeChainId,
|
||||
tryNativeToUint8Array(targetDeployInfo.tokenAddress, targetNetwork.wormholeChainId)
|
||||
);
|
||||
console.log(`${src} Network has new PortalWrappedToken for ${target} network at ${foreignAddress}`);
|
||||
}
|
||||
|
||||
|
||||
export async function registerApp(src:string, target:string){
|
||||
const srcNetwork = config.networks[src];
|
||||
const targetNetwork = config.networks[target];
|
||||
|
@ -301,6 +325,7 @@ export async function balance(src: string, target: string) : Promise<string>{
|
|||
return (await connection.getBalance(srcKey.publicKey)).toString()
|
||||
}
|
||||
|
||||
setDefaultWasm("node")
|
||||
// Else get the Token Balance of the Foreign Network's token on the Src Network
|
||||
const foreignAddress = await getForeignAssetSolana(
|
||||
connection,
|
||||
|
|
|
@ -63,8 +63,9 @@ xmint
|
|||
await srcHandler.registerApp(src,target)
|
||||
try{
|
||||
console.log(`Attesting ${src} Wrapped Native to ${target}`);
|
||||
await srcHandler.attest(target, src, config.networks[src].wrappedNativeAddress)
|
||||
await srcHandler.attest(src, target, config.networks[src].wrappedNativeAddress)
|
||||
} catch (e) {
|
||||
console.log("ERROR: ", e);
|
||||
console.log("Wrapped Native attestion exists already")
|
||||
}
|
||||
|
||||
|
@ -157,6 +158,7 @@ xmint
|
|||
balance = await evm.balance(src, target);
|
||||
break;
|
||||
case "solana":
|
||||
balance = await solana.balance(src, target);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -166,7 +168,7 @@ xmint
|
|||
xmint
|
||||
.command("debug")
|
||||
.action(async () => {
|
||||
solana.createWrapped('sol0', 'evm0', 'AQAAAAABAN/Tvs+PQEPxFJzlILkIPBNCEZSDYRmLKAOdJ3ve8ddlL9ZsDFuxKYDdGYg4JvT2F+UghSCBNlWrh+DH8M1yiD4BYw0WejBGAQAAAgAAAAAAAAAAAAAAAAKQ+xZyCK9FW7E3eAFjt7epoQwWAAAAAAAAAAABAgAAAAAAAAAAAAAAAO6i/B0lX9KKoVxsIyStQLAyZ/nFAAISRVZNMFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFVk0wLVRPS0VOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==')
|
||||
await solana.debug();
|
||||
})
|
||||
|
||||
xmint.parse();
|
|
@ -1,3 +1,5 @@
|
|||
set -e pipefail
|
||||
|
||||
# Rerun solana validator
|
||||
cd ../wormhole-local-validator && npm run evm && npm run solana && npm run wormhole && cd ../xmint
|
||||
|
||||
|
|
Loading…
Reference in New Issue