fix: catch up to recent upstream changes
This commit is contained in:
@ -213,6 +213,11 @@ test('request airdrop', async () => {
|
||||
],
|
||||
tokens: 42,
|
||||
userdata: [],
|
||||
executable: false,
|
||||
loader_program_id: [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
],
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
30
web3.js/test/native-loader.test.js
Normal file
30
web3.js/test/native-loader.test.js
Normal file
@ -0,0 +1,30 @@
|
||||
// @flow
|
||||
|
||||
import {
|
||||
Connection,
|
||||
NativeLoader,
|
||||
Transaction,
|
||||
} from '../src';
|
||||
import {mockRpcEnabled} from './__mocks__/node-fetch';
|
||||
import {url} from './url';
|
||||
import {newAccountWithTokens} from './new-account-with-tokens';
|
||||
|
||||
test('unstable - load', async () => {
|
||||
if (mockRpcEnabled) {
|
||||
console.log('non-live test skipped');
|
||||
return;
|
||||
}
|
||||
|
||||
const connection = new Connection(url);
|
||||
const from = await newAccountWithTokens(connection);
|
||||
|
||||
const noopProgramId = await NativeLoader.load(connection, from, 'noop');
|
||||
const noopTransaction = new Transaction({
|
||||
fee: 0,
|
||||
keys: [from.publicKey],
|
||||
programId: noopProgramId,
|
||||
});
|
||||
const signature = await connection.sendTransaction(from, noopTransaction);
|
||||
expect(connection.confirmTransaction(signature)).resolves.toBe(true);
|
||||
});
|
||||
|
@ -3,13 +3,8 @@
|
||||
import {
|
||||
Account,
|
||||
BudgetProgram,
|
||||
Connection,
|
||||
SystemProgram,
|
||||
Transaction,
|
||||
} from '../src';
|
||||
import {mockRpcEnabled} from './__mocks__/node-fetch';
|
||||
import {url} from './url';
|
||||
import {newAccountWithTokens} from './new-account-with-tokens';
|
||||
|
||||
test('createAccount', () => {
|
||||
const from = new Account();
|
||||
@ -61,33 +56,3 @@ test('assign', () => {
|
||||
// TODO: Validate transaction contents more
|
||||
});
|
||||
|
||||
test('unstable - load', async () => {
|
||||
if (mockRpcEnabled) {
|
||||
console.log('non-live test skipped');
|
||||
return;
|
||||
}
|
||||
|
||||
const connection = new Connection(url);
|
||||
const from = await newAccountWithTokens(connection);
|
||||
const noopProgramId = (new Account()).publicKey;
|
||||
|
||||
const loadTransaction = SystemProgram.load(
|
||||
from.publicKey,
|
||||
noopProgramId,
|
||||
'noop',
|
||||
);
|
||||
|
||||
let signature = await connection.sendTransaction(from, loadTransaction);
|
||||
expect(connection.confirmTransaction(signature)).resolves.toBe(true);
|
||||
|
||||
const noopTransaction = new Transaction({
|
||||
fee: 0,
|
||||
keys: [from.publicKey],
|
||||
programId: noopProgramId,
|
||||
});
|
||||
signature = await connection.sendTransaction(from, noopTransaction);
|
||||
expect(connection.confirmTransaction(signature)).resolves.toBe(true);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
@ -120,6 +120,11 @@ test('create new token', async () => {
|
||||
10, 0, 0, 0, 0, 0, 0, 0, 84, 101, 115, 116, 32, 116, 111, 107, 101, 110,
|
||||
4, 0, 0, 0, 0, 0, 0, 0, 84, 69, 83, 84
|
||||
],
|
||||
executable: false,
|
||||
loader_program_id: [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
],
|
||||
}
|
||||
}
|
||||
]);
|
||||
@ -153,6 +158,11 @@ test('create new token', async () => {
|
||||
16, 39, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
],
|
||||
executable: false,
|
||||
loader_program_id: [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
],
|
||||
}
|
||||
}
|
||||
]);
|
||||
@ -204,6 +214,11 @@ test('create new token account', async () => {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
],
|
||||
executable: false,
|
||||
loader_program_id: [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
],
|
||||
}
|
||||
}
|
||||
]);
|
||||
@ -256,6 +271,11 @@ test('transfer', async () => {
|
||||
123, 0, 0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
],
|
||||
executable: false,
|
||||
loader_program_id: [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
],
|
||||
}
|
||||
}
|
||||
]);
|
||||
@ -293,6 +313,11 @@ test('transfer', async () => {
|
||||
123, 0, 0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
],
|
||||
executable: false,
|
||||
loader_program_id: [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
],
|
||||
}
|
||||
}
|
||||
]);
|
||||
@ -355,6 +380,11 @@ test('approve/revoke', async () => {
|
||||
1,
|
||||
...initialOwnerTokenAccount.toBuffer(),
|
||||
],
|
||||
executable: false,
|
||||
loader_program_id: [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
],
|
||||
}
|
||||
}
|
||||
]);
|
||||
@ -403,6 +433,11 @@ test('approve/revoke', async () => {
|
||||
1,
|
||||
...initialOwnerTokenAccount.toBuffer(),
|
||||
],
|
||||
executable: false,
|
||||
loader_program_id: [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
],
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
Reference in New Issue
Block a user