chore: fix token tests (#11975)

This commit is contained in:
Justin Starry 2020-09-02 01:58:40 +08:00 committed by GitHub
parent 7341e60043
commit d1c08d0b04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 56 deletions

View File

@ -4808,13 +4808,13 @@
}
},
"@solana/spl-token": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.0.5.tgz",
"integrity": "sha512-OXW/zHzMQqVGcSNrNt8sRaHlKT5vjdcUcmUHi8d4ssG8ChbZVA2lkJK10XDXlcnMIiSTindpEjiFmooYc9K3uQ==",
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.0.7.tgz",
"integrity": "sha512-lXpvGlcjq49efiCb61VlrRwKyMSHXV5lqCvrf+iDJarftvWEK9WV97ZuunOPkA2wXyPzc880wtwvvfoEt30Lbg==",
"dev": true,
"requires": {
"@babel/runtime": "^7.10.5",
"@solana/web3.js": "^0.64.0",
"@solana/web3.js": "^0.71.6",
"bn.js": "^5.0.0",
"buffer-layout": "^1.2.0",
"dotenv": "8.2.0",
@ -4822,9 +4822,9 @@
}
},
"@solana/web3.js": {
"version": "0.64.2",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-0.64.2.tgz",
"integrity": "sha512-aGRG1rn8fLerE4NscRL6rq0nSyYAK9K+TGRZxb6ue7Ontufa6wO1kxum4zJs17+xT0zVf8wABUtCMgP4W7FxpA==",
"version": "0.71.9",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-0.71.9.tgz",
"integrity": "sha512-xn/6i3XwKA6RMKlVWxurKpJukHoJtiYm1W/r0cDVZYde7WHObm5F3W3bUjgO5K1lO0tHAEEf9/pyCpF6R73U0g==",
"dev": true,
"requires": {
"@babel/runtime": "^7.3.1",
@ -4838,44 +4838,10 @@
"mz": "^2.7.0",
"node-fetch": "^2.2.0",
"npm-run-all": "^4.1.5",
"rpc-websockets": "^5.0.8",
"rpc-websockets": "^7.1.0",
"superstruct": "^0.8.3",
"tweetnacl": "^1.0.0",
"ws": "^7.0.0"
},
"dependencies": {
"rpc-websockets": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-5.3.1.tgz",
"integrity": "sha512-rIxEl1BbXRlIA9ON7EmY/2GUM7RLMy8zrUPTiLPFiYnYOz0I3PXfCmDDrge5vt4pW4oIcAXBDvgZuJ1jlY5+VA==",
"dev": true,
"requires": {
"@babel/runtime": "^7.8.7",
"assert-args": "^1.2.1",
"babel-runtime": "^6.26.0",
"circular-json": "^0.5.9",
"eventemitter3": "^3.1.2",
"uuid": "^3.4.0",
"ws": "^5.2.2"
},
"dependencies": {
"ws": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz",
"integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==",
"dev": true,
"requires": {
"async-limiter": "~1.0.0"
}
}
}
},
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
}
},
"@szmarczak/http-timer": {

View File

@ -97,7 +97,7 @@
"@babel/preset-flow": "^7.0.0",
"@commitlint/config-conventional": "^9.0.1",
"@commitlint/travis-cli": "^9.0.1",
"@solana/spl-token": "^0.0.5",
"@solana/spl-token": "^0.0.7",
"@typescript-eslint/eslint-plugin": "^2.18.0",
"@typescript-eslint/parser": "^2.18.0",
"acorn": "^7.0.0",

View File

@ -512,9 +512,7 @@ function createRpcRequest(url): RpcRequest {
let waitTime = 500;
for (;;) {
res = await fetch(url, options);
if (
res.status !== 429 /* Too many requests */
) {
if (res.status !== 429 /* Too many requests */) {
break;
}
too_many_requests_retries -= 1;
@ -522,7 +520,7 @@ function createRpcRequest(url): RpcRequest {
break;
}
console.log(
`Server responded with ${res.status} ${res.statusText}. Retrying after ${waitTime}ms delay...`,
`Server responded with ${res.status} ${res.statusText}. Retrying after ${waitTime}ms delay...`,
);
await sleep(waitTime);
waitTime *= 2;

View File

@ -1326,7 +1326,7 @@ test('get supply', async () => {
});
const TOKEN_PROGRAM_ID = new PublicKey(
'TokenSVp5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o',
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
);
describe('token methods', () => {
@ -1353,28 +1353,30 @@ describe('token methods', () => {
const mintOwner = new Account();
const accountOwner = new Account();
const [token, tokenAccount] = await Token.createMint(
const token = await Token.createMint(
connection,
payerAccount,
mintOwner.publicKey,
accountOwner.publicKey,
new u64(11111),
null,
2,
TOKEN_PROGRAM_ID,
false,
);
await Token.createMint(
const tokenAccount = await token.createAccount(accountOwner.publicKey);
await token.mintTo(tokenAccount, mintOwner, [], 11111);
const token2 = await Token.createMint(
connection,
payerAccount,
mintOwner.publicKey,
accountOwner.publicKey,
new u64(10000),
null,
2,
TOKEN_PROGRAM_ID,
false,
);
const token2Account = await token2.createAccount(accountOwner.publicKey);
await token2.mintTo(token2Account, mintOwner, [], 100);
const tokenAccountDest = await token.createAccount(accountOwner.publicKey);
testSignature = await token.transfer(
tokenAccount,