Remove Budget from CLI (#11451)
* Remove support for Budget Also: * Make "pay" command a deprecated alias for the "transfer" command * chore: remove budget from web3.js * Drop Budget depedency from core Validators no longer ship with builtin Budget
This commit is contained in:
@ -1,80 +0,0 @@
|
||||
// @flow
|
||||
|
||||
import {Account} from '../src/account';
|
||||
import {BudgetProgram} from '../src/budget-program';
|
||||
|
||||
test('pay', () => {
|
||||
const from = new Account();
|
||||
const program = new Account();
|
||||
const to = new Account();
|
||||
let transaction;
|
||||
|
||||
transaction = BudgetProgram.pay(
|
||||
from.publicKey,
|
||||
program.publicKey,
|
||||
to.publicKey,
|
||||
123,
|
||||
);
|
||||
expect(transaction.instructions[0].keys).toHaveLength(2);
|
||||
expect(transaction.instructions[1].keys).toHaveLength(2);
|
||||
// TODO: Validate transaction contents more
|
||||
|
||||
transaction = BudgetProgram.pay(
|
||||
from.publicKey,
|
||||
program.publicKey,
|
||||
to.publicKey,
|
||||
123,
|
||||
BudgetProgram.signatureCondition(from.publicKey),
|
||||
);
|
||||
expect(transaction.instructions[0].keys).toHaveLength(2);
|
||||
expect(transaction.instructions[1].keys).toHaveLength(1);
|
||||
// TODO: Validate transaction contents more
|
||||
|
||||
transaction = BudgetProgram.pay(
|
||||
from.publicKey,
|
||||
program.publicKey,
|
||||
to.publicKey,
|
||||
123,
|
||||
BudgetProgram.signatureCondition(from.publicKey),
|
||||
BudgetProgram.timestampCondition(from.publicKey, new Date()),
|
||||
);
|
||||
expect(transaction.instructions[0].keys).toHaveLength(2);
|
||||
expect(transaction.instructions[1].keys).toHaveLength(1);
|
||||
// TODO: Validate transaction contents more
|
||||
|
||||
transaction = BudgetProgram.payOnBoth(
|
||||
from.publicKey,
|
||||
program.publicKey,
|
||||
to.publicKey,
|
||||
123,
|
||||
BudgetProgram.signatureCondition(from.publicKey),
|
||||
BudgetProgram.timestampCondition(from.publicKey, new Date()),
|
||||
);
|
||||
expect(transaction.instructions[0].keys).toHaveLength(2);
|
||||
expect(transaction.instructions[1].keys).toHaveLength(1);
|
||||
// TODO: Validate transaction contents more
|
||||
});
|
||||
|
||||
test('apply', () => {
|
||||
const from = new Account();
|
||||
const program = new Account();
|
||||
const to = new Account();
|
||||
let transaction;
|
||||
|
||||
transaction = BudgetProgram.applyTimestamp(
|
||||
from.publicKey,
|
||||
program.publicKey,
|
||||
to.publicKey,
|
||||
new Date(),
|
||||
);
|
||||
expect(transaction.keys).toHaveLength(3);
|
||||
// TODO: Validate transaction contents more
|
||||
|
||||
transaction = BudgetProgram.applySignature(
|
||||
from.publicKey,
|
||||
program.publicKey,
|
||||
to.publicKey,
|
||||
);
|
||||
expect(transaction.keys).toHaveLength(3);
|
||||
// TODO: Validate transaction contents more
|
||||
});
|
@ -2,8 +2,8 @@
|
||||
|
||||
import {
|
||||
Account,
|
||||
BudgetProgram,
|
||||
Connection,
|
||||
StakeProgram,
|
||||
SystemInstruction,
|
||||
SystemProgram,
|
||||
Transaction,
|
||||
@ -26,8 +26,8 @@ test('createAccount', () => {
|
||||
fromPubkey: new Account().publicKey,
|
||||
newAccountPubkey: new Account().publicKey,
|
||||
lamports: 123,
|
||||
space: BudgetProgram.space,
|
||||
programId: BudgetProgram.programId,
|
||||
space: 0,
|
||||
programId: SystemProgram.programId,
|
||||
};
|
||||
const transaction = SystemProgram.createAccount(params);
|
||||
expect(transaction.instructions).toHaveLength(1);
|
||||
@ -110,8 +110,8 @@ test('createAccountWithSeed', () => {
|
||||
basePubkey: fromPubkey,
|
||||
seed: 'hi there',
|
||||
lamports: 123,
|
||||
space: BudgetProgram.space,
|
||||
programId: BudgetProgram.programId,
|
||||
space: 0,
|
||||
programId: SystemProgram.programId,
|
||||
};
|
||||
const transaction = SystemProgram.createAccountWithSeed(params);
|
||||
expect(transaction.instructions).toHaveLength(1);
|
||||
@ -228,7 +228,6 @@ test('nonceAuthorize', () => {
|
||||
|
||||
test('non-SystemInstruction error', () => {
|
||||
const from = new Account();
|
||||
const program = new Account();
|
||||
const to = new Account();
|
||||
|
||||
const badProgramId = {
|
||||
@ -236,7 +235,7 @@ test('non-SystemInstruction error', () => {
|
||||
{pubkey: from.publicKey, isSigner: true, isWritable: true},
|
||||
{pubkey: to.publicKey, isSigner: false, isWritable: true},
|
||||
],
|
||||
programId: BudgetProgram.programId,
|
||||
programId: StakeProgram.programId,
|
||||
data: Buffer.from([2, 0, 0, 0]),
|
||||
};
|
||||
expect(() => {
|
||||
@ -245,16 +244,10 @@ test('non-SystemInstruction error', () => {
|
||||
);
|
||||
}).toThrow();
|
||||
|
||||
const amount = 123;
|
||||
const recentBlockhash = 'EETubP5AKHgjPAhzPAFcb8BAY1hMH639CWCFTqi3hq1k'; // Arbitrary known recentBlockhash
|
||||
const budgetPay = BudgetProgram.pay(
|
||||
from.publicKey,
|
||||
program.publicKey,
|
||||
to.publicKey,
|
||||
amount,
|
||||
);
|
||||
const transaction = new Transaction({recentBlockhash}).add(budgetPay);
|
||||
transaction.sign(from);
|
||||
const stakePubkey = new Account().publicKey;
|
||||
const authorizedPubkey = new Account().publicKey;
|
||||
const params = {stakePubkey, authorizedPubkey};
|
||||
const transaction = StakeProgram.deactivate(params);
|
||||
|
||||
expect(() => {
|
||||
SystemInstruction.decodeInstructionType(transaction.instructions[1]);
|
||||
|
Reference in New Issue
Block a user