Skip to content

Commit

Permalink
s/getBaker/getDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
Keefer Taylor committed Dec 10, 2020
1 parent e128be6 commit 1c9eabf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions integration_test/chain/tezos/TezosNodeReader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,28 @@ describe('TezosNodeReader integration test suite', () => {
});

it('Gets delegate for a delegated implicit account', async () => {
const result = await TezosNodeReader.getBaker(tezosServer, "tz1PnUd6R31MnjEE8VhfZhZdbGc1hrWQvjnK");
const result = await TezosNodeReader.getDelegate(tezosServer, "tz1PnUd6R31MnjEE8VhfZhZdbGc1hrWQvjnK");
expect(result).to.not.be.undefined
});

it('Gets delegate for a delegated smart contract', async () => {
const result = await TezosNodeReader.getBaker(tezosServer, "KT1DRJPyaDTgeXrM2cgQdp5siNF8PP5RLS7T");
const result = await TezosNodeReader.getDelegate(tezosServer, "KT1DRJPyaDTgeXrM2cgQdp5siNF8PP5RLS7T");
expect(result).to.not.be.undefined
});

it('Gets delegate for a baker as itself', async () => {
const baker = "tz1Na5QB98cDA3BC1SQU4w3iiWGVGktU14LE"
const result = await TezosNodeReader.getBaker(tezosServer, baker);
const result = await TezosNodeReader.getDelegate(tezosServer, baker);
expect(result).to.be.equal(baker)
});

it('Returns undefined for undelegated implicit account', async () => {
const result = await TezosNodeReader.getBaker(tezosServer, "tz1fzHtv2UqtXzFUBHuBPh2xXVv5Pv5MTh5Z");
const result = await TezosNodeReader.getDelegate(tezosServer, "tz1fzHtv2UqtXzFUBHuBPh2xXVv5Pv5MTh5Z");
expect(result).to.be.undefined
});

it('Returns undefined for undelegated smart contract', async () => {
const result = await TezosNodeReader.getBaker(tezosServer, "KT1BipUDR93YFCJjVpghzVFS8N45Lkgigfqs");
const result = await TezosNodeReader.getDelegate(tezosServer, "KT1BipUDR93YFCJjVpghzVFS8N45Lkgigfqs");
expect(result).to.be.undefined
});
});
4 changes: 2 additions & 2 deletions src/chain/tezos/TezosNodeReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ export namespace TezosNodeReader {
}

/**
* Gets the baker for a smart contract or an implicit account.
* Gets the delegate for a smart contract or an implicit account.
*
* @param {string} server Tezos node to query
* @param {stirng} address The smart contract address or implicit account to query.
*/
export async function getBaker(server: string, address: string): Promise<string | undefined> {
export async function getDelegate(server: string, address: string): Promise<string | undefined> {
const requestUrl = `chains/main/blocks/head/context/contracts/${address}/delegate`

try {
Expand Down

0 comments on commit 1c9eabf

Please sign in to comment.