Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeHowarth authored and derpy-duck committed Aug 17, 2023
1 parent e1aed0c commit 7b7b44a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 38 deletions.
50 changes: 25 additions & 25 deletions sdk/js/scripts/compileAnchorIdls.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,38 @@ const DST_IDL = __dirname + "/../src/anchor-idl";
const TS = __dirname + "/../src/solana/types";

const programs = {
"wormhole.json": "Wormhole",
"token_bridge.json": "TokenBridge",
"nft_bridge.json": "NftBridge",
"wormhole.json": "Wormhole",
"token_bridge.json": "TokenBridge",
"nft_bridge.json": "NftBridge",
};

function main() {
if (!fs.existsSync(DST_IDL)) {
fs.mkdirSync(DST_IDL);
}
if (!fs.existsSync(DST_IDL)) {
fs.mkdirSync(DST_IDL);
}

if (!fs.existsSync(TS)) {
fs.mkdirSync(TS);
}
if (!fs.existsSync(TS)) {
fs.mkdirSync(TS);
}

for (const basename of fs.readdirSync(SRC_IDL)) {
const idl = DST_IDL + "/" + basename;
fs.copyFileSync(SRC_IDL + "/" + basename, idl);
for (const basename of fs.readdirSync(SRC_IDL)) {
const idl = DST_IDL + "/" + basename;
fs.copyFileSync(SRC_IDL + "/" + basename, idl);

const targetTypescript = TS + "/" + snakeToCamel(basename).replace("json", "ts");
const targetTypescript =
TS + "/" + snakeToCamel(basename).replace("json", "ts");

const programType = programs[basename];
fs.writeFileSync(targetTypescript, `export type ${programType} = `);
fs.appendFileSync(targetTypescript, fs.readFileSync(idl));
}
const programType = programs[basename];
fs.writeFileSync(targetTypescript, `export type ${programType} = `);
fs.appendFileSync(targetTypescript, fs.readFileSync(idl));
}
}

const snakeToCamel = str =>
str.toLowerCase().replace(/([-_][a-z])/g, group =>
group
.toUpperCase()
.replace('-', '')
.replace('_', '')
);
const snakeToCamel = (str) =>
str
.toLowerCase()
.replace(/([-_][a-z])/g, (group) =>
group.toUpperCase().replace("-", "").replace("_", "")
);

main();
main();
6 changes: 2 additions & 4 deletions sdk/js/src/relayer/relayer/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export type DeliveryTargetInfo = {
sourceVaaSequence: BigNumber | null;
gasUsed: BigNumber;
refundStatus: RefundStatus;
revertString?: string; // Only defined if status is RECEIVER_FAILURE
revertString?: string; // Only defined if status is RECEIVER_FAILURE
overrides?: DeliveryOverrideArgs;
};

Expand Down Expand Up @@ -278,9 +278,7 @@ export function transformDeliveryLog(log: {
gasUsed: BigNumber.from(log.args[5]),
refundStatus: parseRefundStatus(log.args[6]),
revertString:
status == DeliveryStatus.ReceiverFailure
? log.args[7]
: undefined,
status == DeliveryStatus.ReceiverFailure ? log.args[7] : undefined,
overrides:
Buffer.from(log.args[8].substring(2), "hex").length > 0
? parseOverrideInfoFromDeliveryEvent(
Expand Down
16 changes: 7 additions & 9 deletions sdk/js/src/relayer/relayer/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,13 @@ export function stringifyWormholeRelayerInfo(
: ""
}Gas used: ${e.gasUsed.toString()}\nTransaction fee used: ${ethers.utils.formatEther(
executionInfo.targetChainRefundPerGasUnused.mul(e.gasUsed)
)} of ${targetChainName} currency\n${
`Refund amount: ${ethers.utils.formatEther(
executionInfo.targetChainRefundPerGasUnused.mul(
executionInfo.gasLimit.sub(e.gasUsed)
)
)} of ${targetChainName} currency \nRefund status: ${
e.refundStatus
}\n`
}`
)} of ${targetChainName} currency\n${`Refund amount: ${ethers.utils.formatEther(
executionInfo.targetChainRefundPerGasUnused.mul(
executionInfo.gasLimit.sub(e.gasUsed)
)
)} of ${targetChainName} currency \nRefund status: ${
e.refundStatus
}\n`}`
)
.join("\n");
} else if (
Expand Down

0 comments on commit 7b7b44a

Please sign in to comment.