Skip to content

Commit

Permalink
merging in trap changes
Browse files Browse the repository at this point in the history
  • Loading branch information
krpeacock committed Oct 11, 2024
1 parent b4a90fb commit d983a95
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion e2e/node/basic/trap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import util from 'util';
import exec from 'child_process';
const execAsync = util.promisify(exec.exec);

const { stdout } = await execAsync('dfx canister id trap');
// eslint-disable-next-line prefer-const
let stdout;
try {
({ stdout } = await execAsync('dfx canister id trap'));
} catch {
await execAsync('dfx deploy trap');
({ stdout } = await execAsync('dfx canister id trap'));
}

export const idlFactory = ({ IDL }) => {
return IDL.Service({
Expand Down
6 changes: 3 additions & 3 deletions packages/agent/src/utils/callAndPoll.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Principal } from '@dfinity/principal';
import { Agent, Certificate, bufFromBufLike, polling } from '..';
import { Agent, Certificate, bufFromBufLike, polling, v3ResponseBody } from '..';
import { AgentError } from '../errors';

/**
Expand Down Expand Up @@ -31,8 +31,8 @@ export async function callAndPoll(options: {
});

let certificate: Certificate;
if (response.body && response.body.certificate) {
const cert = response.body.certificate;
if (response.body && (response.body as v3ResponseBody).certificate) {
const cert = (response.body as v3ResponseBody).certificate;
// Create certificate to validate the responses
certificate = await Certificate.create({
certificate: bufFromBufLike(cert),
Expand Down

0 comments on commit d983a95

Please sign in to comment.