use new Provider interface (#30)

This commit is contained in:
Paul 2022-04-11 14:23:45 -04:00 committed by GitHub
parent 3da36aaae7
commit 2ac6045cf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@ const TAKER_FEE = 0.0022;
describe("swap", () => { describe("swap", () => {
// Configure the client to use the local cluster. // Configure the client to use the local cluster.
anchor.setProvider(anchor.Provider.env()); anchor.setProvider(anchor.AnchorProvider.env());
// Swap program client. // Swap program client.
const program = anchor.workspace.Swap; const program = anchor.workspace.Swap;
@ -212,7 +212,7 @@ describe("swap", () => {
); );
// Send it. // Send it.
await program.provider.send(tx, [openOrders]); await program.provider.sendAndConfirm(tx, [openOrders]);
// Balance after the transaction. // Balance after the transaction.
const afterAccount = await program.provider.connection.getAccountInfo( const afterAccount = await program.provider.connection.getAccountInfo(

View File

@ -196,7 +196,7 @@ async function fundAccount({ provider, mints }) {
}; };
// Transfer lamports to market maker. // Transfer lamports to market maker.
await provider.send( await provider.sendAndConfirm(
(() => { (() => {
const tx = new Transaction(); const tx = new Transaction();
tx.add( tx.add(
@ -226,7 +226,7 @@ async function fundAccount({ provider, mints }) {
MARKET_MAKER.publicKey MARKET_MAKER.publicKey
); );
await provider.send( await provider.sendAndConfirm(
(() => { (() => {
const tx = new Transaction(); const tx = new Transaction();
tx.add( tx.add(
@ -293,7 +293,7 @@ async function setupMarket({
feeDiscountPubkey: null, feeDiscountPubkey: null,
selfTradeBehavior: "abortTransaction", selfTradeBehavior: "abortTransaction",
}); });
await provider.send(transaction, signers.concat(marketMaker.account)); await provider.sendAndConfirm(transaction, signers.concat(marketMaker.account));
} }
for (let k = 0; k < bids.length; k += 1) { for (let k = 0; k < bids.length; k += 1) {
@ -314,7 +314,7 @@ async function setupMarket({
feeDiscountPubkey: null, feeDiscountPubkey: null,
selfTradeBehavior: "abortTransaction", selfTradeBehavior: "abortTransaction",
}); });
await provider.send(transaction, signers.concat(marketMaker.account)); await provider.sendAndConfirm(transaction, signers.concat(marketMaker.account));
} }
return MARKET_A_USDC; return MARKET_A_USDC;