@aeternity/aepp-sdk 14.1.0 → 14.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"Cli.js","names":["execFile","tmpdir","resolve","dirname","basename","mkdir","writeFile","rm","fileURLToPath","CompilerBase","CompilerError","InternalError","UnsupportedVersionError","semverSatisfies","ensureError","getPackagePath","path","import","meta","url","_path","WeakMap","_ensureCompatibleVersion","_CompilerCli_brand","WeakSet","CompilerCli","constructor","compilerPath","ignoreVersion","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_classPrivateFieldSet","version","then","versions","error","console","warn","message","compile","_classPrivateFieldGet","compileRes","aci","Promise","all","_assertClassBrand","_runWithStderr","call","generateAci","bytecode","stdout","trimEnd","warnings","stderr","split","slice","map","warning","reg","match","pos","file","line","col","compileBySourceCode","sourceCode","fileSystem","tmp","_saveContractToTmpDir","recursive","JSON","parse","_run","generateAciBySourceCode","validate","includes","validateBySourceCode","verMessage","ver","parameters","pResolve","pReject","randomName","Math","random","toString","sourceCodePath","Object","entries","name","src","p"],"sources":["../../../src/contract/compiler/Cli.ts"],"sourcesContent":["import { execFile } from 'child_process';\nimport { tmpdir } from 'os';\nimport { resolve, dirname, basename } from 'path';\nimport { mkdir, writeFile, rm } from 'fs/promises';\nimport { fileURLToPath } from 'url';\nimport CompilerBase, { Aci, CompileResult } from './Base.js';\nimport { Encoded } from '../../utils/encoder.js';\nimport { CompilerError, InternalError, UnsupportedVersionError } from '../../utils/errors.js';\nimport semverSatisfies from '../../utils/semver-satisfies.js';\nimport { ensureError } from '../../utils/other.js';\n\nexport const getPackagePath = (): string => {\n const path = dirname(fileURLToPath(import.meta.url));\n if (basename(path) === 'dist') return resolve(path, '..');\n if (basename(path) === 'compiler') return resolve(path, '../../..');\n throw new InternalError(\"Can't get package path\");\n};\n\n/**\n * A wrapper around aesophia_cli, available only in Node.js.\n * Requires Erlang installed, assumes that `escript` is available in PATH.\n * @category contract\n */\nexport default class CompilerCli extends CompilerBase {\n readonly #path: string;\n\n readonly #ensureCompatibleVersion;\n\n /**\n * @param compilerPath - A path to aesophia_cli binary, by default uses the integrated one\n * @param options - Options\n * @param options.ignoreVersion - Print warning instead of throwing exception if compiler version\n * is not supported, use with caution\n */\n constructor(\n compilerPath = resolve(getPackagePath(), './bin/aesophia_cli'),\n { ignoreVersion = false }: { ignoreVersion?: boolean } = {},\n ) {\n super();\n this.#path = compilerPath;\n this.#ensureCompatibleVersion = this.version().then((version) => {\n const versions = [version, '8.0.0', '9.0.0'] as const;\n if (!semverSatisfies(...versions)) {\n const error = new UnsupportedVersionError('compiler', ...versions);\n if (ignoreVersion) console.warn(error.message);\n else throw error;\n }\n });\n }\n\n async #runWithStderr(...parameters: string[]): Promise<{ stderr: string; stdout: string }> {\n return new Promise((pResolve, pReject) => {\n execFile('escript', [this.#path, ...parameters], (error, stdout, stderr) => {\n if (error != null) pReject(error);\n else pResolve({ stdout, stderr });\n });\n });\n }\n\n async #run(...parameters: string[]): Promise<string> {\n const { stderr, stdout } = await this.#runWithStderr(...parameters);\n if (stderr !== '') throw new CompilerError(stderr);\n return stdout;\n }\n\n static async #saveContractToTmpDir(\n sourceCode: string,\n fileSystem: Record<string, string> = {},\n ): Promise<string> {\n const randomName = (): string => Math.random().toString(36).slice(2);\n const path = resolve(tmpdir(), `aepp-sdk-js-${randomName()}`);\n await mkdir(path);\n const sourceCodePath = resolve(path, `${randomName()}.aes`);\n await writeFile(sourceCodePath, sourceCode);\n await Promise.all(\n Object.entries(fileSystem).map(async ([name, src]) => {\n const p = resolve(path, name);\n await mkdir(dirname(p), { recursive: true });\n return writeFile(p, src);\n }),\n );\n return sourceCodePath;\n }\n\n async compile(path: string): CompileResult {\n await this.#ensureCompatibleVersion;\n try {\n const [compileRes, aci] = await Promise.all([\n this.#runWithStderr(path),\n this.generateAci(path),\n ]);\n return {\n bytecode: compileRes.stdout.trimEnd() as Encoded.ContractBytearray,\n aci,\n warnings: compileRes.stderr\n .split('Warning in ')\n .slice(1)\n .map((warning) => {\n const reg = /^'(.+)' at line (\\d+), col (\\d+):\\n(.+)$/s;\n const match = warning.match(reg);\n if (match == null) throw new InternalError(`Can't parse compiler output: \"${warning}\"`);\n return {\n message: match[4].trimEnd(),\n pos: {\n ...(match[1] !== path && { file: match[1] }),\n line: +match[2],\n col: +match[3],\n },\n };\n }),\n };\n } catch (error) {\n ensureError(error);\n throw new CompilerError(error.message);\n }\n }\n\n async compileBySourceCode(\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): CompileResult {\n const tmp = await CompilerCli.#saveContractToTmpDir(sourceCode, fileSystem);\n try {\n return await this.compile(tmp);\n } finally {\n await rm(dirname(tmp), { recursive: true });\n }\n }\n\n async generateAci(path: string): Promise<Aci> {\n await this.#ensureCompatibleVersion;\n try {\n return JSON.parse(await this.#run('--no_code', '--create_json_aci', path));\n } catch (error) {\n ensureError(error);\n throw new CompilerError(error.message);\n }\n }\n\n async generateAciBySourceCode(\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<Aci> {\n const tmp = await CompilerCli.#saveContractToTmpDir(sourceCode, fileSystem);\n try {\n return await this.generateAci(tmp);\n } finally {\n await rm(dirname(tmp), { recursive: true });\n }\n }\n\n async validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean> {\n await this.#ensureCompatibleVersion;\n try {\n return (await this.#run(path, '--validate', bytecode)).includes('Validation successful.');\n } catch (error) {\n return false;\n }\n }\n\n async validateBySourceCode(\n bytecode: Encoded.ContractBytearray,\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<boolean> {\n const tmp = await CompilerCli.#saveContractToTmpDir(sourceCode, fileSystem);\n try {\n return await this.validate(bytecode, tmp);\n } finally {\n await rm(dirname(tmp), { recursive: true });\n }\n }\n\n async version(): Promise<string> {\n const verMessage = await this.#run('--version');\n const ver = verMessage.match(/Sophia compiler version ([\\d.]+.*)\\n/)?.[1];\n if (ver == null)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B,MAAMgB,UAAU,GAAGA,CAAA,KAAcC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAAC9B,KAAK,CAAC,CAAC,CAAC;EACpE,MAAMvC,IAAI,GAAGd,OAAO,CAACD,MAAM,CAAC,CAAC,EAAE,eAAeiF,UAAU,CAAC,CAAC,EAAE,CAAC;EAC7D,MAAM7E,KAAK,CAACW,IAAI,CAAC;EACjB,MAAMsE,cAAc,GAAGpF,OAAO,CAACc,IAAI,EAAE,GAAGkE,UAAU,CAAC,CAAC,MAAM,CAAC;EAC3D,MAAM5E,SAAS,CAACgF,cAAc,EAAErB,UAAU,CAAC;EAC3C,MAAMtB,OAAO,CAACC,GAAG,CACf2C,MAAM,CAACC,OAAO,CAACtB,UAAU,CAAC,CAACV,GAAG,CAAC,OAAO,CAACiC,IAAI,EAAEC,GAAG,CAAC,KAAK;IACpD,MAAMC,CAAC,GAAGzF,OAAO,CAACc,IAAI,EAAEyE,IAAI,CAAC;IAC7B,MAAMpF,KAAK,CAACF,OAAO,CAACwF,CAAC,CAAC,EAAE;MAAEtB,SAAS,EAAE;IAAK,CAAC,CAAC;IAC5C,OAAO/D,SAAS,CAACqF,CAAC,EAAED,GAAG,CAAC;EAC1B,CAAC,CACH,CAAC;EACD,OAAOJ,cAAc;AACvB","ignoreList":[]}
1
+ {"version":3,"file":"Cli.js","names":["execFile","tmpdir","resolve","dirname","basename","relative","isAbsolute","mkdir","writeFile","rm","fileURLToPath","CompilerBase","CompilerError","IllegalArgumentError","InternalError","UnsupportedVersionError","semverSatisfies","ensureError","getPackagePath","path","import","meta","url","_path","WeakMap","_ensureCompatibleVersion","_CompilerCli_brand","WeakSet","CompilerCli","constructor","compilerPath","ignoreVersion","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_classPrivateFieldSet","version","then","versions","error","console","warn","message","compile","_classPrivateFieldGet","compileRes","aci","Promise","all","_assertClassBrand","_runWithStderr","call","generateAci","bytecode","stdout","trimEnd","warnings","stderr","split","slice","map","warning","reg","match","pos","file","line","col","compileBySourceCode","sourceCode","fileSystem","tmp","_saveContractToTmpDir","recursive","JSON","parse","_run","generateAciBySourceCode","validate","includes","validateBySourceCode","verMessage","ver","parameters","pResolve","pReject","randomName","Math","random","toString","sourceCodePath","Object","entries","name","src","p","rel","startsWith"],"sources":["../../../src/contract/compiler/Cli.ts"],"sourcesContent":["import { execFile } from 'child_process';\nimport { tmpdir } from 'os';\nimport { resolve, dirname, basename, relative, isAbsolute } from 'path';\nimport { mkdir, writeFile, rm } from 'fs/promises';\nimport { fileURLToPath } from 'url';\nimport CompilerBase, { Aci, CompileResult } from './Base.js';\nimport { Encoded } from '../../utils/encoder.js';\nimport {\n CompilerError,\n IllegalArgumentError,\n InternalError,\n UnsupportedVersionError,\n} from '../../utils/errors.js';\nimport semverSatisfies from '../../utils/semver-satisfies.js';\nimport { ensureError } from '../../utils/other.js';\n\nexport const getPackagePath = (): string => {\n const path = dirname(fileURLToPath(import.meta.url));\n if (basename(path) === 'dist') return resolve(path, '..');\n if (basename(path) === 'compiler') return resolve(path, '../../..');\n throw new InternalError(\"Can't get package path\");\n};\n\n/**\n * A wrapper around aesophia_cli, available only in Node.js.\n * Requires Erlang installed, assumes that `escript` is available in PATH.\n * @category contract\n */\nexport default class CompilerCli extends CompilerBase {\n readonly #path: string;\n\n readonly #ensureCompatibleVersion;\n\n /**\n * @param compilerPath - A path to aesophia_cli binary, by default uses the integrated one\n * @param options - Options\n * @param options.ignoreVersion - Print warning instead of throwing exception if compiler version\n * is not supported, use with caution\n */\n constructor(\n compilerPath = resolve(getPackagePath(), './bin/aesophia_cli'),\n { ignoreVersion = false }: { ignoreVersion?: boolean } = {},\n ) {\n super();\n this.#path = compilerPath;\n this.#ensureCompatibleVersion = this.version().then((version) => {\n const versions = [version, '8.0.0', '9.0.0'] as const;\n if (!semverSatisfies(...versions)) {\n const error = new UnsupportedVersionError('compiler', ...versions);\n if (ignoreVersion) console.warn(error.message);\n else throw error;\n }\n });\n }\n\n async #runWithStderr(...parameters: string[]): Promise<{ stderr: string; stdout: string }> {\n return new Promise((pResolve, pReject) => {\n execFile('escript', [this.#path, ...parameters], (error, stdout, stderr) => {\n if (error != null) pReject(error);\n else pResolve({ stdout, stderr });\n });\n });\n }\n\n async #run(...parameters: string[]): Promise<string> {\n const { stderr, stdout } = await this.#runWithStderr(...parameters);\n if (stderr !== '') throw new CompilerError(stderr);\n return stdout;\n }\n\n static async #saveContractToTmpDir(\n sourceCode: string,\n fileSystem: Record<string, string> = {},\n ): Promise<string> {\n const randomName = (): string => Math.random().toString(36).slice(2);\n const path = resolve(tmpdir(), `aepp-sdk-js-${randomName()}`);\n await mkdir(path);\n const sourceCodePath = resolve(path, `${randomName()}.aes`);\n await writeFile(sourceCodePath, sourceCode);\n await Promise.all(\n Object.entries(fileSystem).map(async ([name, src]) => {\n const p = resolve(path, name);\n const rel = relative(path, p);\n if (isAbsolute(rel) || rel.startsWith('..')) {\n throw new IllegalArgumentError(`Path \"${name}\" is outside of the temp directory`);\n }\n await mkdir(dirname(p), { recursive: true });\n return writeFile(p, src);\n }),\n );\n return sourceCodePath;\n }\n\n async compile(path: string): CompileResult {\n await this.#ensureCompatibleVersion;\n try {\n const [compileRes, aci] = await Promise.all([\n this.#runWithStderr(path),\n this.generateAci(path),\n ]);\n return {\n bytecode: compileRes.stdout.trimEnd() as Encoded.ContractBytearray,\n aci,\n warnings: compileRes.stderr\n .split('Warning in ')\n .slice(1)\n .map((warning) => {\n const reg = /^'(.+)' at line (\\d+), col (\\d+):\\n(.+)$/s;\n const match = warning.match(reg);\n if (match == null) throw new InternalError(`Can't parse compiler output: \"${warning}\"`);\n return {\n message: match[4].trimEnd(),\n pos: {\n ...(match[1] !== path && { file: match[1] }),\n line: +match[2],\n col: +match[3],\n },\n };\n }),\n };\n } catch (error) {\n ensureError(error);\n throw new CompilerError(error.message);\n }\n }\n\n async compileBySourceCode(\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): CompileResult {\n const tmp = await CompilerCli.#saveContractToTmpDir(sourceCode, fileSystem);\n try {\n return await this.compile(tmp);\n } finally {\n await rm(dirname(tmp), { recursive: true });\n }\n }\n\n async generateAci(path: string): Promise<Aci> {\n await this.#ensureCompatibleVersion;\n try {\n return JSON.parse(await this.#run('--no_code', '--create_json_aci', path));\n } catch (error) {\n ensureError(error);\n throw new CompilerError(error.message);\n }\n }\n\n async generateAciBySourceCode(\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<Aci> {\n const tmp = await CompilerCli.#saveContractToTmpDir(sourceCode, fileSystem);\n try {\n return await this.generateAci(tmp);\n } finally {\n await rm(dirname(tmp), { recursive: true });\n }\n }\n\n async validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean> {\n await this.#ensureCompatibleVersion;\n try {\n return (await this.#run(path, '--validate', bytecode)).includes('Validation successful.');\n } catch (error) {\n return false;\n }\n }\n\n async validateBySourceCode(\n bytecode: Encoded.ContractBytearray,\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<boolean> {\n const tmp = await CompilerCli.#saveContractToTmpDir(sourceCode, fileSystem);\n try {\n return await this.validate(bytecode, tmp);\n } finally {\n await rm(dirname(tmp), { recursive: true });\n }\n }\n\n async version(): Promise<string> {\n const verMessage = await this.#run('--version');\n const ver = verMessage.match(/Sophia compiler version ([\\d.]+.*)\\n/)?.[1];\n if (ver == null) throw new CompilerError(\"Can't get compiler version\");\n return ver;\n }\n}\n"],"mappings":";;;;;;AAAA,SAASA,QAAQ,QAAQ,eAAe;AACxC,SAASC,MAAM,QAAQ,IAAI;AAC3B,SAASC,OAAO,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,MAAM;AACvE,SAASC,KAAK,EAAEC,SAAS,EAAEC,EAAE,QAAQ,aAAa;AAClD,SAASC,aAAa,QAAQ,KAAK;AACnC,OAAOC,YAAY,MAA8B,WAAW;AAE5D,SACEC,aAAa,EACbC,oB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iB,IAAI,EAAE,GAAGkE,UAAU,CAAC,CAAC,MAAM,CAAC;EAC3D,MAAM7E,SAAS,CAACiF,cAAc,EAAErB,UAAU,CAAC;EAC3C,MAAMtB,OAAO,CAACC,GAAG,CACf2C,MAAM,CAACC,OAAO,CAACtB,UAAU,CAAC,CAACV,GAAG,CAAC,OAAO,CAACiC,IAAI,EAAEC,GAAG,CAAC,KAAK;IACpD,MAAMC,CAAC,GAAG5F,OAAO,CAACiB,IAAI,EAAEyE,IAAI,CAAC;IAC7B,MAAMG,GAAG,GAAG1F,QAAQ,CAACc,IAAI,EAAE2E,CAAC,CAAC;IAC7B,IAAIxF,UAAU,CAACyF,GAAG,CAAC,IAAIA,GAAG,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;MAC3C,MAAM,IAAInF,oBAAoB,CAAC,SAAS+E,IAAI,oCAAoC,CAAC;IACnF;IACA,MAAMrF,KAAK,CAACJ,OAAO,CAAC2F,CAAC,CAAC,EAAE;MAAEtB,SAAS,EAAE;IAAK,CAAC,CAAC;IAC5C,OAAOhE,SAAS,CAACsF,CAAC,EAAED,GAAG,CAAC;EAC1B,CAAC,CACH,CAAC;EACD,OAAOJ,cAAc;AACvB","ignoreList":[]}
@@ -5,10 +5,9 @@ import { _getPollInterval } from '../../../chain.js';
5
5
  */
6
6
  declare const _default: {
7
7
  serialize(value: number | undefined): Buffer;
8
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
8
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
9
9
  onNode?: Node;
10
10
  absoluteTtl?: boolean;
11
- _isInternalBuild?: boolean;
12
11
  } & Omit<Parameters<typeof _getPollInterval>[1], "onNode">): Promise<number | undefined>;
13
12
  deserialize(value: Buffer): number;
14
13
  };
@@ -2,6 +2,10 @@ import shortUInt from './short-u-int.js';
2
2
  import { ArgumentError } from '../../../utils/errors.js';
3
3
  import { getHeight } from '../../../chain.js';
4
4
 
5
+ // TODO: restore after the mainnet mining issue is solved, was used via `_isInternalBuild` flag
6
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
+ const DEFAULT_INTERNAL_RELATIVE_TTL = 3;
8
+
5
9
  /**
6
10
  * Time to leave
7
11
  */
@@ -15,16 +19,15 @@ export default {
15
19
  {
16
20
  onNode,
17
21
  absoluteTtl,
18
- _isInternalBuild,
19
22
  ...options
20
23
  }) {
21
- if (absoluteTtl !== true && value !== 0 && (value != null || _isInternalBuild === true)) {
24
+ if (absoluteTtl !== true && value !== 0 && value != null) {
22
25
  if (onNode == null) throw new ArgumentError('onNode', 'provided', onNode);
23
- value = (value !== null && value !== void 0 ? value : 3) + (await getHeight({
26
+ value += await getHeight({
24
27
  ...options,
25
28
  onNode,
26
29
  cached: true
27
- }));
30
+ });
28
31
  }
29
32
  return value;
30
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ttl.js","names":["shortUInt","ArgumentError","getHeight","serialize","value","prepare","params","onNode","absoluteTtl","_isInternalBuild","options","cached"],"sources":["../../../../src/tx/builder/field-types/ttl.ts"],"sourcesContent":["import shortUInt from './short-u-int.js';\nimport Node from '../../../Node.js';\nimport { ArgumentError } from '../../../utils/errors.js';\nimport { _getPollInterval, getHeight } from '../../../chain.js';\n\n/**\n * Time to leave\n */\nexport default {\n ...shortUInt,\n\n serialize(value: number | undefined): Buffer {\n return shortUInt.serialize(value ?? 0);\n },\n\n async prepare(\n value: number | undefined,\n params: {},\n // TODO: { absoluteTtl: true } | { absoluteTtl: false, onNode: Node }\n {\n onNode,\n absoluteTtl,\n _isInternalBuild,\n ...options\n }: {\n onNode?: Node;\n absoluteTtl?: boolean;\n _isInternalBuild?: boolean;\n } & Omit<Parameters<typeof _getPollInterval>[1], 'onNode'>,\n ) {\n if (absoluteTtl !== true && value !== 0 && (value != null || _isInternalBuild === true)) {\n if (onNode == null) throw new ArgumentError('onNode', 'provided', onNode);\n value = (value ?? 3) + (await getHeight({ ...options, onNode, cached: true }));\n }\n return value;\n },\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,kBAAkB;AAExC,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAA2BC,SAAS,QAAQ,mBAAmB;;AAE/D;AACA;AACA;AACA,eAAe;EACb,GAAGF,SAAS;EAEZG,SAASA,CAACC,KAAyB,EAAU;IAC3C,OAAOJ,SAAS,CAACG,SAAS,CAACC,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC;EACxC,CAAC;EAED,MAAMC,OAAOA,CACXD,KAAyB,EACzBE,MAAU;EACV;EACA;IACEC,MAAM;IACNC,WAAW;IACXC,gBAAgB;IAChB,GAAGC;EAKoD,CAAC,EAC1D;IACA,IAAIF,WAAW,KAAK,IAAI,IAAIJ,KAAK,KAAK,CAAC,KAAKA,KAAK,IAAI,IAAI,IAAIK,gBAAgB,KAAK,IAAI,CAAC,EAAE;MACvF,IAAIF,MAAM,IAAI,IAAI,EAAE,MAAM,IAAIN,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAEM,MAAM,CAAC;MACzEH,KAAK,GAAG,CAACA,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,KAAK,MAAMF,SAAS,CAAC;QAAE,GAAGQ,OAAO;QAAEH,MAAM;QAAEI,MAAM,EAAE;MAAK,CAAC,CAAC,CAAC;IAChF;IACA,OAAOP,KAAK;EACd;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ttl.js","names":["shortUInt","ArgumentError","getHeight","DEFAULT_INTERNAL_RELATIVE_TTL","serialize","value","prepare","params","onNode","absoluteTtl","options","cached"],"sources":["../../../../src/tx/builder/field-types/ttl.ts"],"sourcesContent":["import shortUInt from './short-u-int.js';\nimport Node from '../../../Node.js';\nimport { ArgumentError } from '../../../utils/errors.js';\nimport { _getPollInterval, getHeight } from '../../../chain.js';\n\n// TODO: restore after the mainnet mining issue is solved, was used via `_isInternalBuild` flag\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst DEFAULT_INTERNAL_RELATIVE_TTL = 3;\n\n/**\n * Time to leave\n */\nexport default {\n ...shortUInt,\n\n serialize(value: number | undefined): Buffer {\n return shortUInt.serialize(value ?? 0);\n },\n\n async prepare(\n value: number | undefined,\n params: {},\n // TODO: { absoluteTtl: true } | { absoluteTtl: false, onNode: Node }\n {\n onNode,\n absoluteTtl,\n ...options\n }: {\n onNode?: Node;\n absoluteTtl?: boolean;\n } & Omit<Parameters<typeof _getPollInterval>[1], 'onNode'>,\n ) {\n if (absoluteTtl !== true && value !== 0 && value != null) {\n if (onNode == null) throw new ArgumentError('onNode', 'provided', onNode);\n value += await getHeight({ ...options, onNode, cached: true });\n }\n return value;\n },\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,kBAAkB;AAExC,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAA2BC,SAAS,QAAQ,mBAAmB;;AAE/D;AACA;AACA,MAAMC,6BAA6B,GAAG,CAAC;;AAEvC;AACA;AACA;AACA,eAAe;EACb,GAAGH,SAAS;EAEZI,SAASA,CAACC,KAAyB,EAAU;IAC3C,OAAOL,SAAS,CAACI,SAAS,CAACC,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC;EACxC,CAAC;EAED,MAAMC,OAAOA,CACXD,KAAyB,EACzBE,MAAU;EACV;EACA;IACEC,MAAM;IACNC,WAAW;IACX,GAAGC;EAIoD,CAAC,EAC1D;IACA,IAAID,WAAW,KAAK,IAAI,IAAIJ,KAAK,KAAK,CAAC,IAAIA,KAAK,IAAI,IAAI,EAAE;MACxD,IAAIG,MAAM,IAAI,IAAI,EAAE,MAAM,IAAIP,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAEO,MAAM,CAAC;MACzEH,KAAK,IAAI,MAAMH,SAAS,CAAC;QAAE,GAAGQ,OAAO;QAAEF,MAAM;QAAEG,MAAM,EAAE;MAAK,CAAC,CAAC;IAChE;IACA,OAAON,KAAK;EACd;AACF,CAAC","ignoreList":[]}
@@ -100,10 +100,9 @@ export declare const txSchema: readonly [{
100
100
  };
101
101
  readonly ttl: {
102
102
  serialize(value: number | undefined): Buffer;
103
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
103
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
104
104
  onNode?: import("../../Node.js").default;
105
105
  absoluteTtl?: boolean;
106
- _isInternalBuild?: boolean;
107
106
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
108
107
  deserialize(value: Buffer): number;
109
108
  };
@@ -174,10 +173,9 @@ export declare const txSchema: readonly [{
174
173
  };
175
174
  readonly ttl: {
176
175
  serialize(value: number | undefined): Buffer;
177
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
176
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
178
177
  onNode?: import("../../Node.js").default;
179
178
  absoluteTtl?: boolean;
180
- _isInternalBuild?: boolean;
181
179
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
182
180
  deserialize(value: Buffer): number;
183
181
  };
@@ -243,10 +241,9 @@ export declare const txSchema: readonly [{
243
241
  };
244
242
  readonly ttl: {
245
243
  serialize(value: number | undefined): Buffer;
246
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
244
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
247
245
  onNode?: import("../../Node.js").default;
248
246
  absoluteTtl?: boolean;
249
- _isInternalBuild?: boolean;
250
247
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
251
248
  deserialize(value: Buffer): number;
252
249
  };
@@ -315,10 +312,9 @@ export declare const txSchema: readonly [{
315
312
  };
316
313
  readonly ttl: {
317
314
  serialize(value: number | undefined): Buffer;
318
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
315
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
319
316
  onNode?: import("../../Node.js").default;
320
317
  absoluteTtl?: boolean;
321
- _isInternalBuild?: boolean;
322
318
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
323
319
  deserialize(value: Buffer): number;
324
320
  };
@@ -387,10 +383,9 @@ export declare const txSchema: readonly [{
387
383
  };
388
384
  readonly ttl: {
389
385
  serialize(value: number | undefined): Buffer;
390
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
386
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
391
387
  onNode?: import("../../Node.js").default;
392
388
  absoluteTtl?: boolean;
393
- _isInternalBuild?: boolean;
394
389
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
395
390
  deserialize(value: Buffer): number;
396
391
  };
@@ -447,10 +442,9 @@ export declare const txSchema: readonly [{
447
442
  };
448
443
  readonly ttl: {
449
444
  serialize(value: number | undefined): Buffer;
450
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
445
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
451
446
  onNode?: import("../../Node.js").default;
452
447
  absoluteTtl?: boolean;
453
- _isInternalBuild?: boolean;
454
448
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
455
449
  deserialize(value: Buffer): number;
456
450
  };
@@ -503,10 +497,9 @@ export declare const txSchema: readonly [{
503
497
  };
504
498
  readonly ttl: {
505
499
  serialize(value: number | undefined): Buffer;
506
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
500
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
507
501
  onNode?: import("../../Node.js").default;
508
502
  absoluteTtl?: boolean;
509
- _isInternalBuild?: boolean;
510
503
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
511
504
  deserialize(value: Buffer): number;
512
505
  };
@@ -569,10 +562,9 @@ export declare const txSchema: readonly [{
569
562
  };
570
563
  readonly ttl: {
571
564
  serialize(value: number | undefined): Buffer;
572
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
565
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
573
566
  onNode?: import("../../Node.js").default;
574
567
  absoluteTtl?: boolean;
575
- _isInternalBuild?: boolean;
576
568
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
577
569
  deserialize(value: Buffer): number;
578
570
  };
@@ -680,10 +672,9 @@ export declare const txSchema: readonly [{
680
672
  };
681
673
  readonly ttl: {
682
674
  serialize(value: number | undefined): Buffer;
683
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
675
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
684
676
  onNode?: import("../../Node.js").default;
685
677
  absoluteTtl?: boolean;
686
- _isInternalBuild?: boolean;
687
678
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
688
679
  deserialize(value: Buffer): number;
689
680
  };
@@ -789,10 +780,9 @@ export declare const txSchema: readonly [{
789
780
  };
790
781
  readonly ttl: {
791
782
  serialize(value: number | undefined): Buffer;
792
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
783
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
793
784
  onNode?: import("../../Node.js").default;
794
785
  absoluteTtl?: boolean;
795
- _isInternalBuild?: boolean;
796
786
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
797
787
  deserialize(value: Buffer): number;
798
788
  };
@@ -864,10 +854,9 @@ export declare const txSchema: readonly [{
864
854
  };
865
855
  readonly ttl: {
866
856
  serialize(value: number | undefined): Buffer;
867
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
857
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
868
858
  onNode?: import("../../Node.js").default;
869
859
  absoluteTtl?: boolean;
870
- _isInternalBuild?: boolean;
871
860
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
872
861
  deserialize(value: Buffer): number;
873
862
  };
@@ -951,10 +940,9 @@ export declare const txSchema: readonly [{
951
940
  };
952
941
  readonly ttl: {
953
942
  serialize(value: number | undefined): Buffer;
954
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
943
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
955
944
  onNode?: import("../../Node.js").default;
956
945
  absoluteTtl?: boolean;
957
- _isInternalBuild?: boolean;
958
946
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
959
947
  deserialize(value: Buffer): number;
960
948
  };
@@ -1019,10 +1007,9 @@ export declare const txSchema: readonly [{
1019
1007
  };
1020
1008
  readonly ttl: {
1021
1009
  serialize(value: number | undefined): Buffer;
1022
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1010
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1023
1011
  onNode?: import("../../Node.js").default;
1024
1012
  absoluteTtl?: boolean;
1025
- _isInternalBuild?: boolean;
1026
1013
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1027
1014
  deserialize(value: Buffer): number;
1028
1015
  };
@@ -1065,10 +1052,9 @@ export declare const txSchema: readonly [{
1065
1052
  };
1066
1053
  readonly ttl: {
1067
1054
  serialize(value: number | undefined): Buffer;
1068
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1055
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1069
1056
  onNode?: import("../../Node.js").default;
1070
1057
  absoluteTtl?: boolean;
1071
- _isInternalBuild?: boolean;
1072
1058
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1073
1059
  deserialize(value: Buffer): number;
1074
1060
  };
@@ -1141,10 +1127,9 @@ export declare const txSchema: readonly [{
1141
1127
  };
1142
1128
  readonly ttl: {
1143
1129
  serialize(value: number | undefined): Buffer;
1144
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1130
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1145
1131
  onNode?: import("../../Node.js").default;
1146
1132
  absoluteTtl?: boolean;
1147
- _isInternalBuild?: boolean;
1148
1133
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1149
1134
  deserialize(value: Buffer): number;
1150
1135
  };
@@ -1202,10 +1187,9 @@ export declare const txSchema: readonly [{
1202
1187
  readonly poi: EntryTreesPoi;
1203
1188
  readonly ttl: {
1204
1189
  serialize(value: number | undefined): Buffer;
1205
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1190
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1206
1191
  onNode?: import("../../Node.js").default;
1207
1192
  absoluteTtl?: boolean;
1208
- _isInternalBuild?: boolean;
1209
1193
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1210
1194
  deserialize(value: Buffer): number;
1211
1195
  };
@@ -1263,10 +1247,9 @@ export declare const txSchema: readonly [{
1263
1247
  readonly poi: EntryTreesPoi;
1264
1248
  readonly ttl: {
1265
1249
  serialize(value: number | undefined): Buffer;
1266
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1250
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1267
1251
  onNode?: import("../../Node.js").default;
1268
1252
  absoluteTtl?: boolean;
1269
- _isInternalBuild?: boolean;
1270
1253
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1271
1254
  deserialize(value: Buffer): number;
1272
1255
  };
@@ -1323,10 +1306,9 @@ export declare const txSchema: readonly [{
1323
1306
  };
1324
1307
  readonly ttl: {
1325
1308
  serialize(value: number | undefined): Buffer;
1326
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1309
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1327
1310
  onNode?: import("../../Node.js").default;
1328
1311
  absoluteTtl?: boolean;
1329
- _isInternalBuild?: boolean;
1330
1312
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1331
1313
  deserialize(value: Buffer): number;
1332
1314
  };
@@ -1391,10 +1373,9 @@ export declare const txSchema: readonly [{
1391
1373
  };
1392
1374
  readonly ttl: {
1393
1375
  serialize(value: number | undefined): Buffer;
1394
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1376
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1395
1377
  onNode?: import("../../Node.js").default;
1396
1378
  absoluteTtl?: boolean;
1397
- _isInternalBuild?: boolean;
1398
1379
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1399
1380
  deserialize(value: Buffer): number;
1400
1381
  };
@@ -1463,10 +1444,9 @@ export declare const txSchema: readonly [{
1463
1444
  };
1464
1445
  readonly ttl: {
1465
1446
  serialize(value: number | undefined): Buffer;
1466
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1447
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1467
1448
  onNode?: import("../../Node.js").default;
1468
1449
  absoluteTtl?: boolean;
1469
- _isInternalBuild?: boolean;
1470
1450
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1471
1451
  deserialize(value: Buffer): number;
1472
1452
  };
@@ -1539,10 +1519,9 @@ export declare const txSchema: readonly [{
1539
1519
  };
1540
1520
  readonly ttl: {
1541
1521
  serialize(value: number | undefined): Buffer;
1542
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1522
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1543
1523
  onNode?: import("../../Node.js").default;
1544
1524
  absoluteTtl?: boolean;
1545
- _isInternalBuild?: boolean;
1546
1525
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1547
1526
  deserialize(value: Buffer): number;
1548
1527
  };
@@ -1624,10 +1603,9 @@ export declare const txSchema: readonly [{
1624
1603
  };
1625
1604
  readonly ttl: {
1626
1605
  serialize(value: number | undefined): Buffer;
1627
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1606
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1628
1607
  onNode?: import("../../Node.js").default;
1629
1608
  absoluteTtl?: boolean;
1630
- _isInternalBuild?: boolean;
1631
1609
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1632
1610
  deserialize(value: Buffer): number;
1633
1611
  };
@@ -1720,10 +1698,9 @@ export declare const txSchema: readonly [{
1720
1698
  };
1721
1699
  readonly ttl: {
1722
1700
  serialize(value: number | undefined): Buffer;
1723
- prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, _isInternalBuild, ...options }: {
1701
+ prepare(value: number | undefined, params: {}, { onNode, absoluteTtl, ...options }: {
1724
1702
  onNode?: import("../../Node.js").default;
1725
1703
  absoluteTtl?: boolean;
1726
- _isInternalBuild?: boolean;
1727
1704
  } & Omit<Parameters<typeof import("../../chain.js")._getPollInterval>[1], "onNode">): Promise<number | undefined>;
1728
1705
  deserialize(value: Buffer): number;
1729
1706
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeternity/aepp-sdk",
3
- "version": "14.1.0",
3
+ "version": "14.1.1",
4
4
  "description": "SDK for the æternity blockchain",
5
5
  "homepage": "https://sdk.aeternity.io/",
6
6
  "main": "dist/aepp-sdk.cjs",
@@ -115,7 +115,7 @@
115
115
  "@types/sinon": "^17.0.4",
116
116
  "@typescript-eslint/eslint-plugin": "^7.15.0",
117
117
  "@typescript-eslint/parser": "^7.15.0",
118
- "autorest": "^3.7.1",
118
+ "autorest": "^3.7.2",
119
119
  "babel-loader": "^10.0.0",
120
120
  "babel-plugin-import-globals": "^2.0.0",
121
121
  "babel-plugin-transform-import-meta": "^2.3.2",