Skip to content

Commit

Permalink
Linting deploy.ts file
Browse files Browse the repository at this point in the history
  • Loading branch information
dimpar committed Jul 25, 2023
1 parent 3ab2244 commit 4e06f53
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions cross-chain/solana/migrations/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import * as anchor from "@coral-xyz/anchor";
import * as web3 from "@solana/web3.js";
import fs from "fs";
import { Keypair } from "@solana/web3.js";
import dotenv from "dotenv";
import * as anchor from "@coral-xyz/anchor"
import * as web3 from "@solana/web3.js"
import fs from "fs"
import { Keypair } from "@solana/web3.js"
import dotenv from "dotenv"

module.exports = async function (provider) {
dotenv.config({ path: "../solana.env" })

anchor.setProvider(provider);
anchor.setProvider(provider)

const program = anchor.workspace.Tbtc;
const program = anchor.workspace.Tbtc
// This wallet deployed the program and is also an authority
const authority = loadKey(process.env.WALLET);
const tbtcKeys = loadKey(process.env.TBTC_KEYS);
const minterKeys = loadKey(process.env.MINTER_KEYS);
const authority = loadKey(process.env.WALLET)
const tbtcKeys = loadKey(process.env.TBTC_KEYS)
const minterKeys = loadKey(process.env.MINTER_KEYS)

const [tbtcMintPDA, ] = web3.PublicKey.findProgramAddressSync(
const [tbtcMintPDA] = web3.PublicKey.findProgramAddressSync(
[
anchor.utils.bytes.utf8.encode("tbtc-mint"),
tbtcKeys.publicKey.toBuffer(),
],
program.programId,
);
program.programId
)

// Initalize tbtc program
await program.methods
Expand All @@ -32,17 +32,17 @@ module.exports = async function (provider) {
authority: authority.publicKey,
})
.signers([tbtcKeys])
.rpc();
.rpc()

const [minterInfoPDA, ] = web3.PublicKey.findProgramAddressSync(
const [minterInfoPDA] = web3.PublicKey.findProgramAddressSync(
[
anchor.utils.bytes.utf8.encode('minter-info'),
anchor.utils.bytes.utf8.encode("minter-info"),
tbtcKeys.publicKey.toBuffer(),
minterKeys.publicKey.toBuffer(),
],
program.programId
);
)

// add minter keys (minterKeys is the wormholeGateway-keypair)
await program.methods
.addMinter()
Expand All @@ -54,20 +54,20 @@ module.exports = async function (provider) {
minterInfo: minterInfoPDA,
})
.signers([minterKeys])
.rpc();
.rpc()

// add a guardian?

// update mappings (self, arbitrum, optimism, polygon)
};
}

function loadKey(filename: string): Keypair {
try {
const contents = fs.readFileSync(filename).toString();
const bs = Uint8Array.from(JSON.parse(contents));
const contents = fs.readFileSync(filename).toString()
const bs = Uint8Array.from(JSON.parse(contents))

return Keypair.fromSecretKey(bs);
return Keypair.fromSecretKey(bs)
} catch {
console.log("Unable to read keypair...", filename);
console.log("Unable to read keypair...", filename)
}
}

0 comments on commit 4e06f53

Please sign in to comment.