fix: Rename lastId to blockhash
This commit is contained in:
@ -5,7 +5,7 @@ import {SYSTEM_TOKEN_PROGRAM_ID} from '../src/token-program';
|
||||
import {mockRpc, mockRpcEnabled} from './__mocks__/node-fetch';
|
||||
import {url} from './url';
|
||||
import {newAccountWithTokens} from './new-account-with-tokens';
|
||||
import {mockGetLastId} from './mockrpc/getlastid';
|
||||
import {mockGetRecentBlockhash} from './mockrpc/get-recent-blockhash';
|
||||
import {sleep} from '../src/util/sleep';
|
||||
|
||||
if (!mockRpcEnabled) {
|
||||
@ -48,29 +48,29 @@ let initialOwnerTokenAccount: PublicKey;
|
||||
|
||||
test('create new token', async () => {
|
||||
const connection = new Connection(url);
|
||||
connection._disableLastIdCaching = mockRpcEnabled;
|
||||
connection._disableBlockhashCaching = mockRpcEnabled;
|
||||
|
||||
initialOwner = await newAccountWithTokens(connection, 1024);
|
||||
|
||||
{
|
||||
// mock SystemProgram.createAccount transaction for Token.createNewToken()
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
|
||||
// mock Token.newAccount() transaction
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus('SignatureNotFound');
|
||||
mockGetSignatureStatus();
|
||||
|
||||
// mock SystemProgram.createAccount transaction for Token.createNewToken()
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
|
||||
// mock Token.createNewToken() transaction
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus('SignatureNotFound');
|
||||
mockGetSignatureStatus();
|
||||
@ -228,17 +228,17 @@ test('create new token', async () => {
|
||||
|
||||
test('create new token account', async () => {
|
||||
const connection = new Connection(url);
|
||||
connection._disableLastIdCaching = mockRpcEnabled;
|
||||
connection._disableBlockhashCaching = mockRpcEnabled;
|
||||
const destOwner = await newAccountWithTokens(connection);
|
||||
|
||||
{
|
||||
// mock SystemProgram.createAccount transaction for Token.newAccount()
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
|
||||
// mock Token.newAccount() transaction
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
}
|
||||
@ -287,17 +287,17 @@ test('create new token account', async () => {
|
||||
|
||||
test('transfer', async () => {
|
||||
const connection = new Connection(url);
|
||||
connection._disableLastIdCaching = mockRpcEnabled;
|
||||
connection._disableBlockhashCaching = mockRpcEnabled;
|
||||
const destOwner = await newAccountWithTokens(connection);
|
||||
|
||||
{
|
||||
// mock SystemProgram.createAccount transaction for Token.newAccount()
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
|
||||
// mock Token.newAccount() transaction
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
}
|
||||
@ -337,7 +337,7 @@ test('transfer', async () => {
|
||||
]);
|
||||
|
||||
// mock Token.transfer() transaction
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
}
|
||||
@ -385,17 +385,17 @@ test('transfer', async () => {
|
||||
|
||||
test('approve/revoke', async () => {
|
||||
const connection = new Connection(url);
|
||||
connection._disableLastIdCaching = mockRpcEnabled;
|
||||
connection._disableBlockhashCaching = mockRpcEnabled;
|
||||
const delegateOwner = await newAccountWithTokens(connection);
|
||||
|
||||
{
|
||||
// mock SystemProgram.createAccount transaction for Token.newAccount()
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
|
||||
// mock Token.newAccount() transaction
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
}
|
||||
@ -406,7 +406,7 @@ test('approve/revoke', async () => {
|
||||
|
||||
{
|
||||
// mock Token.approve() transaction
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
}
|
||||
@ -474,7 +474,7 @@ test('approve/revoke', async () => {
|
||||
|
||||
{
|
||||
// mock Token.revoke() transaction
|
||||
mockGetLastId();
|
||||
mockGetRecentBlockhash();
|
||||
mockSendTransaction();
|
||||
mockGetSignatureStatus();
|
||||
}
|
||||
@ -542,7 +542,7 @@ test('invalid approve', async () => {
|
||||
}
|
||||
|
||||
const connection = new Connection(url);
|
||||
connection._disableLastIdCaching = mockRpcEnabled;
|
||||
connection._disableBlockhashCaching = mockRpcEnabled;
|
||||
const owner = await newAccountWithTokens(connection);
|
||||
|
||||
const account1 = await testToken.newAccount(owner);
|
||||
@ -567,7 +567,7 @@ test('fail on approve overspend', async () => {
|
||||
}
|
||||
|
||||
const connection = new Connection(url);
|
||||
connection._disableLastIdCaching = mockRpcEnabled;
|
||||
connection._disableBlockhashCaching = mockRpcEnabled;
|
||||
const owner = await newAccountWithTokens(connection);
|
||||
|
||||
const account1 = await testToken.newAccount(owner);
|
||||
@ -611,7 +611,7 @@ test('set owner', async () => {
|
||||
}
|
||||
|
||||
const connection = new Connection(url);
|
||||
connection._disableLastIdCaching = mockRpcEnabled;
|
||||
connection._disableBlockhashCaching = mockRpcEnabled;
|
||||
const owner = await newAccountWithTokens(connection);
|
||||
const newOwner = await newAccountWithTokens(connection);
|
||||
|
||||
|
Reference in New Issue
Block a user