diff --git a/src/api/methods.js b/src/api/methods.js index 99e40368..bca16903 100644 --- a/src/api/methods.js +++ b/src/api/methods.js @@ -287,7 +287,7 @@ export default [ { "api": "database_api", "method": "verify_authority", - "params": ["trx"] + "params": ["trx", "auth"] }, { "api": "database_api", diff --git a/test/hf20-accounts.test.js b/test/hf20-accounts.test.js index 4a66acad..e494c12e 100644 --- a/test/hf20-accounts.test.js +++ b/test/hf20-accounts.test.js @@ -3,8 +3,14 @@ import should from 'should'; import steem from '../src'; const username = process.env.STEEM_USERNAME || 'guest123'; -const password = process.env.STEEM_PASSWORD; -const activeWif = steem.auth.toWif(username, password, 'active'); +const passwrod = process.env.STEEM_PASSWORD; +const activeWif = '5K4RDXLLjoyvKttRj8jG9utT7GZmM9qNkePT6uRfWxKf19g322R'; +const activePub = steem.auth.wifToPublic( activeWif ); +const testAuth = { + 'weight_threshold': 1, + 'account_auths': [], + 'key_auths': [[activePub, 1]] +}; describe('steem.hf20-accounts:', () => { it('has generated methods', () => { @@ -20,9 +26,10 @@ describe('steem.hf20-accounts:', () => { describe('claimAccount', () => { -/* Skip these tests. Steem-js test infrastructure not set up for testing active auths - Blocked by Steem issue #3546 it('signs and verifies auth', function(done) { + let url = steem.config.get('uri'); + steem.api.setOptions({ url: url, useAppbaseApi: true }); + let tx = { 'operations': [[ 'claim_account', { @@ -35,7 +42,7 @@ describe('steem.hf20-accounts:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} ); @@ -71,6 +78,5 @@ describe('steem.hf20-accounts:', () => { }, (err) => {done(err)}); }); }); -*/ }); }); diff --git a/test/hf21-sps.test.js b/test/hf21-sps.test.js index bb628ab3..936b0ad7 100644 --- a/test/hf21-sps.test.js +++ b/test/hf21-sps.test.js @@ -4,8 +4,13 @@ import should from 'should'; import steem from '../src'; const username = process.env.STEEM_USERNAME || 'guest123'; -const password = process.env.STEEM_PASSWORD; -const activeWif = steem.auth.toWif(username, password, 'active'); +const activeWif = '5K4RDXLLjoyvKttRj8jG9utT7GZmM9qNkePT6uRfWxKf19g322R'; +const activePub = steem.auth.wifToPublic( activeWif ); +const testAuth = { + 'weight_threshold': 1, + 'account_auths': [], + 'key_auths': [[activePub, 1]] +}; describe('steem.hf21-accounts:', () => { it('has generated methods', () => { @@ -21,9 +26,9 @@ describe('steem.hf21-accounts:', () => { }); describe('create proposal ops', () => { -/* Skip these tests. Steem-js test infrastructure not set up for testing active auths - Blocked by Steem issue #3546 it('signs and verifies create_proposal', function(done) { + let url = steem.config.get('uri'); + steem.api.setOptions({ url: url, useAppbaseApi: true }); let permlink = 'test'; let tx = { @@ -45,7 +50,7 @@ describe('steem.hf21-accounts:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} ); @@ -73,6 +78,5 @@ describe('steem.hf21-accounts:', () => { ); }); }) -*/ }); }); diff --git a/test/smt.test.js b/test/smt.test.js index 1421f6dc..7d4a0d73 100644 --- a/test/smt.test.js +++ b/test/smt.test.js @@ -4,8 +4,13 @@ import should from 'should'; import steem from '../src'; const username = process.env.STEEM_USERNAME || 'guest123'; -const password = process.env.STEEM_PASSWORD; -const activeWif = steem.auth.toWif(username, password, 'active'); +const activeWif = '5K4RDXLLjoyvKttRj8jG9utT7GZmM9qNkePT6uRfWxKf19g322R'; +const activePub = steem.auth.wifToPublic( activeWif ); +const testAuth = { + 'weight_threshold': 1, + 'account_auths': [], + 'key_auths': [[activePub, 1]] +}; describe('steem.smt:', () => { @@ -30,7 +35,7 @@ describe('steem.smt:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} ); @@ -98,7 +103,7 @@ describe('steem.smt:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} ); @@ -141,7 +146,7 @@ describe('steem.smt:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} ); @@ -169,7 +174,7 @@ describe('steem.smt:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} ); @@ -198,7 +203,7 @@ describe('steem.smt:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} ); @@ -224,7 +229,7 @@ describe('steem.smt:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} ); @@ -259,7 +264,7 @@ describe('steem.smt:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} ); @@ -296,7 +301,7 @@ describe('steem.smt:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} ); @@ -325,7 +330,7 @@ describe('steem.smt:', () => { steem.broadcast._prepareTransaction(tx).then(function(tx){ tx = steem.auth.signTransaction(tx, [activeWif]); - steem.api.verifyAuthorityAsync(tx).then( + steem.api.verifyAuthorityAsync(tx, testAuth).then( (result) => {result.should.equal(true); done();}, (err) => {done(err);} );