diff --git a/ts/wasm/lib/detailed/complex_operations/role_classes/categories/hive_authority/hive_role_authority_definition.ts b/ts/wasm/lib/detailed/complex_operations/role_classes/categories/hive_authority/hive_role_authority_definition.ts index 8ce56d083404c9f5435bc5ab70c659455df9a2b0..730134e7e11de989d3eef83f2637abb2deaa6dcb 100644 --- a/ts/wasm/lib/detailed/complex_operations/role_classes/categories/hive_authority/hive_role_authority_definition.ts +++ b/ts/wasm/lib/detailed/complex_operations/role_classes/categories/hive_authority/hive_role_authority_definition.ts @@ -3,6 +3,7 @@ import { TAccountName } from "../../../../hive_apps_operations/index.js"; import { WaxError } from "../../../../errors.js"; import { LevelBase } from "../../level_base.js"; import type { TPublicKey } from "../../../../interfaces"; +import { structuredClone } from "../../../../shims/structuredclone.js"; export class HiveRoleAuthorityDefinition<TRole extends string> extends LevelBase<TRole> { public constructor( diff --git a/ts/wasm/lib/detailed/formatters/base.ts b/ts/wasm/lib/detailed/formatters/base.ts index 4f689f12a7753a358fb0b192ccfb0b9d26ba66db..1b69dd663fb4730ebb1a3841c23d31e18282e03d 100644 --- a/ts/wasm/lib/detailed/formatters/base.ts +++ b/ts/wasm/lib/detailed/formatters/base.ts @@ -1,4 +1,5 @@ import { DeepPartial, DeepReadonly, IWaxFormatter, IWaxFormatterOptions } from "./types"; +import { structuredClone } from "../shims/structuredclone.js"; export const DEFAULT_FORMATTER_OPTIONS: IWaxFormatterOptions = { asset: { diff --git a/ts/wasm/lib/detailed/formatters/waxify.ts b/ts/wasm/lib/detailed/formatters/waxify.ts index 796e230d9e0a47e1ffd4de5765a220a8d00beded..a7be8f530f0f342f6441e2b79f5b2f715ec06b2f 100644 --- a/ts/wasm/lib/detailed/formatters/waxify.ts +++ b/ts/wasm/lib/detailed/formatters/waxify.ts @@ -5,6 +5,7 @@ import { WaxFormatterBase } from "./base"; import { DefaultFormatters } from "./default_formatters"; import Long from "long"; import { getMetadata } from "reflect-metadata/no-conflict"; +import { structuredClone } from "../shims/structuredclone.js"; export interface IMatchersData { matchValues: Map<string, TFormatFunction>; diff --git a/ts/wasm/lib/detailed/shims/structuredclone.ts b/ts/wasm/lib/detailed/shims/structuredclone.ts new file mode 100644 index 0000000000000000000000000000000000000000..4315362f95ef8a42583c5d09b4b02429aebd3e85 --- /dev/null +++ b/ts/wasm/lib/detailed/shims/structuredclone.ts @@ -0,0 +1,6 @@ +export const structuredClone = (value: any) => { + if (typeof globalThis.structuredClone === "undefined") + return JSON.parse(JSON.stringify(value)); + + return globalThis.structuredClone(value); +}; diff --git a/ts/wasm/lib/detailed/transaction.ts b/ts/wasm/lib/detailed/transaction.ts index 0e4bcbe6571e4d28af5402fce957f2bfc8ebf051..7ec354b6ebfa885108a9cd0a26a75fec45f448ea 100644 --- a/ts/wasm/lib/detailed/transaction.ts +++ b/ts/wasm/lib/detailed/transaction.ts @@ -10,6 +10,7 @@ import type { ApiTransaction } from "./api"; import { safeWasmCall } from "./util/wasm_errors"; import type { TAccountName } from "./hive_apps_operations"; import { ISignatureProvider } from "./extensions/signatures"; +import { structuredClone } from "./shims/structuredclone.js"; type TIndexBeginEncryption = { mainEncryptionKey: TPublicKey; diff --git a/ts/wasm/lib/detailed/util/account_authority_caching_provider.ts b/ts/wasm/lib/detailed/util/account_authority_caching_provider.ts index a4795e77485c7474e443c58d21ac662619b8c652..175489cd805423a189920c7b81b020d1dac88250 100644 --- a/ts/wasm/lib/detailed/util/account_authority_caching_provider.ts +++ b/ts/wasm/lib/detailed/util/account_authority_caching_provider.ts @@ -3,6 +3,7 @@ import { TAccountName } from "../hive_apps_operations"; import type { TPublicKey } from "../interfaces"; import { WaxError } from "../errors"; import { ClassHandle, IAccountAuthorityProvider, wax_authority } from "wasm/lib/build_wasm/wax.common"; +import { structuredClone } from "../shims/structuredclone.js"; /** * Helper class used during traced authority verification process. diff --git a/ts/wasm/lib/detailed/util/api_caller.ts b/ts/wasm/lib/detailed/util/api_caller.ts index 59878aadc1ef890b87d3318e3c7ef75a5628bbdb..8bb3eac39b0fb50bb2547774ef821721ad6f65fc 100644 --- a/ts/wasm/lib/detailed/util/api_caller.ts +++ b/ts/wasm/lib/detailed/util/api_caller.ts @@ -3,6 +3,7 @@ import { type TWaxApiRequest } from "../interfaces"; import { extractBracedStrings } from "../rest-api/utils.js"; import { objectToQueryString } from "./query_string.js"; import { type IDetailedResponseData, type IRequestOptions, RequestHelper } from "./request_helper.js"; +import { structuredClone } from "../shims/structuredclone.js"; export type TInterceptorRequestOptions = IRequestOptions & { paths: string[]; apiCallerId: string };