Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove name parameter from exchanges.get method #141

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/integration-scripts/multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ async function run() {

msgSaid = await waitForMessage(client4, '/exn/ipex/grant');
console.log('Holder received exchange message with the grant message');
res = await client4.exchanges().get('holder',msgSaid);
res = await client4.exchanges().get(msgSaid);

let [admit, asigs, aend] = await client4
.ipex()
Expand Down
17 changes: 7 additions & 10 deletions src/keri/app/exchanging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,17 @@ export class Exchanges {
return await res.json();
}


/**
* Get exn messages
* Get exn message by said
* @async
* @returns {Promise<any>} A promise to the exn message
* @param name
* @param said
* @returns A promise to the exn message
* @param said The said of the exn message
*/
async get(name:string, said:string) {
let path = `/identifiers/${name}/exchanges/${said}`;
let method = 'GET';
let res = await this.client.fetch(path, method, null);
async get(said: string): Promise<any> {
const path = `/exchanges/${said}`;
const method = 'GET';
const res = await this.client.fetch(path, method, null);
return await res.json();

}
}

Expand Down
15 changes: 5 additions & 10 deletions test/app/exchanging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,21 +381,16 @@ describe('exchange', () => {
it('Get exchange', async () => {
await libsodium.ready;
const bran = '0123456789abcdefghijk';
let client = new SignifyClient(url, bran, Tier.low, boot_url);
const client = new SignifyClient(url, bran, Tier.low, boot_url);
await client.boot();
await client.connect();
let exchanges = client.exchanges();
await exchanges.get(
'aid1',
'EBfdlu8R27Fbx-ehrqwImnK-8Cm79sqbAQ4MmvEAYqao'
);
let lastCall = fetchMock.mock.calls[fetchMock.mock.calls.length - 1]!;
const exchanges = client.exchanges();
await exchanges.get('EBfdlu8R27Fbx-ehrqwImnK-8Cm79sqbAQ4MmvEAYqao');
const lastCall = fetchMock.mock.calls[fetchMock.mock.calls.length - 1]!;
assert.equal(
lastCall[0]!,
url +
'/identifiers/aid1/exchanges/EBfdlu8R27Fbx-ehrqwImnK-8Cm79sqbAQ4MmvEAYqao'
url + '/exchanges/EBfdlu8R27Fbx-ehrqwImnK-8Cm79sqbAQ4MmvEAYqao'
);
assert.equal(lastCall[1]!.method, 'GET');

});
});
Loading