Skip to content

Instantly share code, notes, and snippets.

@dcts
Created April 16, 2024 22:16
Show Gist options
  • Save dcts/25918788037d1bc4112ea2e992aff478 to your computer and use it in GitHub Desktop.
Save dcts/25918788037d1bc4112ea2e992aff478 to your computer and use it in GitHub Desktop.
// Helper function to download data
function downloadObjectAsJson(exportObj: any, exportName: string) {
var dataStr =
"data:text/json;charset=utf-8," +
encodeURIComponent(JSON.stringify(exportObj, null, 2));
var downloadAnchorNode = document.createElement("a");
downloadAnchorNode.setAttribute("href", dataStr);
downloadAnchorNode.setAttribute("download", exportName + ".json");
document.body.appendChild(downloadAnchorNode); // required for firefox
downloadAnchorNode.click();
downloadAnchorNode.remove();
}
// Add this inside where the options are sorted
const dict: { [x: string]: string } = {};
newOptions.forEach((option) => {
dict[option.address] = option.orderReceiptAddress;
});
downloadObjectAsJson(dict, "orderReceiptNftAddresses");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment