@aeternity/aepp-sdk 13.0.0 → 13.1.0
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.
- package/README.md +4 -2
- package/bin/aesophia_cli +0 -0
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +27068 -16862
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdkBase.d.ts +11 -3
- package/es/AeSdkBase.mjs +24 -3
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +9 -14
- package/es/AeSdkMethods.mjs +20 -49
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/AeSdkWallet.mjs +28 -5
- package/es/AeSdkWallet.mjs.map +1 -1
- package/es/Middleware.d.ts +38 -0
- package/es/Middleware.mjs +90 -0
- package/es/Middleware.mjs.map +1 -0
- package/es/MiddlewareSubscriber.d.ts +30 -0
- package/es/MiddlewareSubscriber.mjs +198 -0
- package/es/MiddlewareSubscriber.mjs.map +1 -0
- package/es/Node.d.ts +1 -1
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +14 -2
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.d.ts +1 -0
- package/es/account/Generalized.mjs +5 -0
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.d.ts +1 -0
- package/es/account/Ledger.mjs +5 -0
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/Memory.d.ts +2 -0
- package/es/account/Memory.mjs +18 -0
- package/es/account/Memory.mjs.map +1 -1
- package/es/account/Rpc.d.ts +1 -6
- package/es/account/Rpc.mjs +24 -10
- package/es/account/Rpc.mjs.map +1 -1
- package/es/aens.d.ts +1 -1
- package/es/aens.mjs +1 -1
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -2
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.d.ts +10 -0
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/aepp-wallet-communication/schema.d.ts +1 -8
- package/es/aepp-wallet-communication/schema.mjs +1 -14
- package/es/aepp-wallet-communication/schema.mjs.map +1 -1
- package/es/aepp-wallet-communication/wallet-detector.d.ts +1 -1
- package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
- package/es/apis/compiler/compiler.mjs +15 -1
- package/es/apis/compiler/compiler.mjs.map +1 -1
- package/es/apis/compiler/models/index.d.ts +1 -7
- package/es/apis/compiler/models/index.mjs.map +1 -1
- package/es/apis/compiler/models/mappers.d.ts +0 -1
- package/es/apis/compiler/models/mappers.mjs +0 -43
- package/es/apis/compiler/models/mappers.mjs.map +1 -1
- package/es/apis/middleware/index.d.ts +2 -0
- package/es/apis/middleware/index.mjs +3 -0
- package/es/apis/middleware/index.mjs.map +1 -0
- package/es/apis/middleware/middleware.d.ts +309 -0
- package/es/apis/middleware/middleware.mjs +1527 -0
- package/es/apis/middleware/middleware.mjs.map +1 -0
- package/es/apis/middleware/models/index.d.ts +1496 -0
- package/es/apis/middleware/models/index.mjs +364 -0
- package/es/apis/middleware/models/index.mjs.map +1 -0
- package/es/apis/middleware/models/mappers.d.ts +102 -0
- package/es/apis/middleware/models/mappers.mjs +3334 -0
- package/es/apis/middleware/models/mappers.mjs.map +1 -0
- package/es/apis/middleware/models/parameters.d.ts +43 -0
- package/es/apis/middleware/models/parameters.mjs +417 -0
- package/es/apis/middleware/models/parameters.mjs.map +1 -0
- package/es/chain.d.ts +2 -1
- package/es/chain.mjs +4 -2
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +1 -1
- package/es/channel/Base.mjs +1 -4
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/internal.mjs +2 -0
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +1 -2
- package/es/contract/Contract.mjs +1 -1
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +21 -0
- package/es/contract/compiler/Base.mjs.map +1 -1
- package/es/contract/compiler/Cli.d.ts +2 -0
- package/es/contract/compiler/Cli.mjs +24 -3
- package/es/contract/compiler/Cli.mjs.map +1 -1
- package/es/contract/compiler/Http.d.ts +2 -0
- package/es/contract/compiler/Http.mjs +22 -2
- package/es/contract/compiler/Http.mjs.map +1 -1
- package/es/contract/compiler/HttpNode.d.ts +1 -0
- package/es/contract/compiler/HttpNode.mjs +5 -0
- package/es/contract/compiler/HttpNode.mjs.map +1 -1
- package/es/deprecated.d.ts +14 -0
- package/es/deprecated.mjs +22 -0
- package/es/deprecated.mjs.map +1 -0
- package/es/index-browser.d.ts +20 -14
- package/es/index-browser.mjs +19 -15
- package/es/index-browser.mjs.map +1 -1
- package/es/tx/builder/constants.d.ts +0 -1
- package/es/tx/builder/constants.mjs +0 -1
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/es/tx/builder/field-types/coin-amount.mjs +2 -1
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/deposit.d.ts +1 -1
- package/es/tx/builder/field-types/entry.mjs +2 -1
- package/es/tx/builder/field-types/entry.mjs.map +1 -1
- package/es/tx/builder/field-types/index.d.ts +2 -2
- package/es/tx/builder/helpers.d.ts +8 -1
- package/es/tx/builder/helpers.mjs +53 -9
- package/es/tx/builder/helpers.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +4 -2
- package/es/tx/builder/index.mjs +0 -1
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +9 -9
- package/es/tx/execution-cost.d.ts +17 -0
- package/es/tx/execution-cost.mjs +17 -0
- package/es/tx/execution-cost.mjs.map +1 -1
- package/es/tx/validator.mjs +6 -3
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/amount-formatter.d.ts +1 -2
- package/es/utils/amount-formatter.mjs +2 -2
- package/es/utils/amount-formatter.mjs.map +1 -1
- package/es/utils/autorest.mjs +6 -8
- package/es/utils/autorest.mjs.map +1 -1
- package/es/utils/crypto.d.ts +1 -0
- package/es/utils/crypto.mjs +12 -2
- package/es/utils/crypto.mjs.map +1 -1
- package/es/utils/errors.d.ts +2 -2
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/other.d.ts +1 -0
- package/es/utils/other.mjs +5 -0
- package/es/utils/other.mjs.map +1 -1
- package/es/utils/typed-data.d.ts +45 -0
- package/es/utils/typed-data.mjs +71 -0
- package/es/utils/typed-data.mjs.map +1 -0
- package/package.json +23 -4
- package/src/AeSdkBase.ts +30 -5
- package/src/AeSdkMethods.ts +31 -50
- package/src/AeSdkWallet.ts +27 -5
- package/src/Middleware.ts +141 -0
- package/src/MiddlewareSubscriber.ts +207 -0
- package/src/Node.ts +1 -1
- package/src/account/Base.ts +20 -3
- package/src/account/Generalized.ts +5 -0
- package/src/account/Ledger.ts +5 -0
- package/src/account/Memory.ts +15 -0
- package/src/account/Rpc.ts +19 -7
- package/src/aens.ts +1 -1
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +11 -3
- package/src/aepp-wallet-communication/rpc/types.ts +11 -0
- package/src/aepp-wallet-communication/schema.ts +2 -17
- package/src/aepp-wallet-communication/wallet-detector.ts +1 -2
- package/src/apis/compiler/compiler.ts +8 -1
- package/src/apis/compiler/models/index.ts +1 -8
- package/src/apis/compiler/models/mappers.ts +0 -36
- package/src/apis/middleware/index.ts +2 -0
- package/src/apis/middleware/middleware.ts +1807 -0
- package/src/apis/middleware/models/index.ts +1747 -0
- package/src/apis/middleware/models/mappers.ts +3370 -0
- package/src/apis/middleware/models/parameters.ts +463 -0
- package/src/chain.ts +3 -2
- package/src/channel/Base.ts +5 -5
- package/src/channel/internal.ts +2 -0
- package/src/contract/Contract.ts +2 -1
- package/src/contract/compiler/Base.ts +26 -0
- package/src/contract/compiler/Cli.ts +27 -3
- package/src/contract/compiler/Http.ts +21 -2
- package/src/contract/compiler/HttpNode.ts +6 -0
- package/src/deprecated.ts +23 -0
- package/src/index-browser.ts +77 -15
- package/src/tx/builder/constants.ts +0 -1
- package/src/tx/builder/field-types/coin-amount.ts +2 -1
- package/src/tx/builder/field-types/entry.ts +1 -1
- package/src/tx/builder/helpers.ts +54 -9
- package/src/tx/builder/index.ts +6 -9
- package/src/tx/execution-cost.ts +17 -0
- package/src/tx/validator.ts +4 -2
- package/src/utils/amount-formatter.ts +1 -1
- package/src/utils/autorest.ts +5 -10
- package/src/utils/crypto.ts +12 -2
- package/src/utils/errors.ts +2 -2
- package/src/utils/other.ts +5 -0
- package/src/utils/typed-data.ts +95 -0
- package/types-legacy/ts4.2/AeSdkBase.d.ts +11 -3
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +9 -14
- package/types-legacy/ts4.2/Middleware.d.ts +46 -0
- package/types-legacy/ts4.2/MiddlewareSubscriber.d.ts +30 -0
- package/types-legacy/ts4.2/Node.d.ts +1 -1
- package/types-legacy/ts4.2/account/Base.d.ts +14 -2
- package/types-legacy/ts4.2/account/Generalized.d.ts +1 -0
- package/types-legacy/ts4.2/account/Ledger.d.ts +1 -0
- package/types-legacy/ts4.2/account/Memory.d.ts +2 -0
- package/types-legacy/ts4.2/account/Rpc.d.ts +1 -6
- package/types-legacy/ts4.2/aens.d.ts +1 -1
- package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +10 -0
- package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +1 -8
- package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +1 -1
- package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -7
- package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +0 -1
- package/types-legacy/ts4.2/apis/middleware/index.d.ts +2 -0
- package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +309 -0
- package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +1496 -0
- package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +102 -0
- package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +43 -0
- package/types-legacy/ts4.2/chain.d.ts +2 -1
- package/types-legacy/ts4.2/channel/Base.d.ts +1 -1
- package/types-legacy/ts4.2/contract/Contract.d.ts +1 -2
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +21 -0
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +2 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +2 -0
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +1 -0
- package/types-legacy/ts4.2/deprecated.d.ts +14 -0
- package/types-legacy/ts4.2/index-browser.d.ts +20 -14
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +0 -1
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/helpers.d.ts +8 -1
- package/types-legacy/ts4.2/tx/builder/index.d.ts +4 -2
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +9 -9
- package/types-legacy/ts4.2/tx/execution-cost.d.ts +17 -0
- package/types-legacy/ts4.2/utils/amount-formatter.d.ts +1 -2
- package/types-legacy/ts4.2/utils/crypto.d.ts +1 -0
- package/types-legacy/ts4.2/utils/errors.d.ts +2 -2
- package/types-legacy/ts4.2/utils/other.d.ts +1 -0
- package/types-legacy/ts4.2/utils/typed-data.d.ts +60 -0
- package/types-legacy/ts4.5/AeSdkBase.d.ts +11 -3
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +9 -14
- package/types-legacy/ts4.5/Middleware.d.ts +46 -0
- package/types-legacy/ts4.5/MiddlewareSubscriber.d.ts +30 -0
- package/types-legacy/ts4.5/Node.d.ts +1 -1
- package/types-legacy/ts4.5/account/Base.d.ts +14 -2
- package/types-legacy/ts4.5/account/Generalized.d.ts +1 -0
- package/types-legacy/ts4.5/account/Ledger.d.ts +1 -0
- package/types-legacy/ts4.5/account/Memory.d.ts +2 -0
- package/types-legacy/ts4.5/account/Rpc.d.ts +1 -6
- package/types-legacy/ts4.5/aens.d.ts +1 -1
- package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +10 -0
- package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +1 -8
- package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +1 -1
- package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -7
- package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +0 -1
- package/types-legacy/ts4.5/apis/middleware/index.d.ts +2 -0
- package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +309 -0
- package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +1496 -0
- package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +102 -0
- package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +43 -0
- package/types-legacy/ts4.5/chain.d.ts +2 -1
- package/types-legacy/ts4.5/channel/Base.d.ts +1 -1
- package/types-legacy/ts4.5/contract/Contract.d.ts +1 -2
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +21 -0
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +2 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +2 -0
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +1 -0
- package/types-legacy/ts4.5/deprecated.d.ts +14 -0
- package/types-legacy/ts4.5/index-browser.d.ts +20 -14
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +0 -1
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/helpers.d.ts +8 -1
- package/types-legacy/ts4.5/tx/builder/index.d.ts +4 -2
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +9 -9
- package/types-legacy/ts4.5/tx/execution-cost.d.ts +17 -0
- package/types-legacy/ts4.5/utils/amount-formatter.d.ts +1 -2
- package/types-legacy/ts4.5/utils/crypto.d.ts +1 -0
- package/types-legacy/ts4.5/utils/errors.d.ts +2 -2
- package/types-legacy/ts4.5/utils/other.d.ts +1 -0
- package/types-legacy/ts4.5/utils/typed-data.d.ts +60 -0
- package/es/typings/@aeternity__aepp-calldata/index.d.mjs +0 -2
- package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +0 -1
- package/src/typings/@aeternity__aepp-calldata/index.d.ts +0 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cli.mjs","names":["_child_process","execFile","_os","tmpdir","_path","resolve","dirname","basename","_fsPromises","mkdir","writeFile","rm","_url","fileURLToPath","CompilerBase","CompilerError","InternalError","UnsupportedVersionError","semverSatisfies","getPackagePath","path","import","meta","url","_path2","WeakMap","_ensureCompatibleVersion","_run","WeakSet","CompilerCli","constructor","compilerPath","arguments","length","undefined","ignoreVersion","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","writable","value","_classPrivateFieldSet","version","then","versions","compile","_classPrivateFieldGet","bytecode","aci","Promise","all","_classPrivateMethodGet","_run2","call","res","JSON","parse","trimEnd","error","message","compileBySourceCode","sourceCode","fileSystem","tmp","_classStaticPrivateMethodGet","_saveContractToTmpDir","recursive","validate","includes","validateBySourceCode","_verMessage$match","verMessage","ver","match","_len","parameters","Array","_key","pResolve","pReject","stdout","stderr","randomName","Math","random","toString","slice","sourceCodePath","Object","entries","map","_ref","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 } from './Base';\nimport { Encoded } from '../../utils/encoder';\nimport { CompilerError, InternalError, UnsupportedVersionError } from '../../utils/errors';\nimport semverSatisfies from '../../utils/semver-satisfies';\n\nconst 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 * Assumes that `escript` is available in PATH.\n */\nexport default class CompilerCli extends CompilerBase {\n #path: string;\n\n #ensureCompatibleVersion: Promise<void>;\n\n constructor(\n compilerPath = resolve(getPackagePath(), './bin/aesophia_cli'),\n { ignoreVersion }: { ignoreVersion?: boolean } = {},\n ) {\n super();\n this.#path = compilerPath;\n if (ignoreVersion !== true) {\n this.#ensureCompatibleVersion = this.version().then((version) => {\n const versions = [version, '7.0.1', '8.0.0'] as const;\n if (!semverSatisfies(...versions)) throw new UnsupportedVersionError('compiler', ...versions);\n });\n }\n }\n\n async #run(...parameters: string[]): Promise<string> {\n return new Promise((pResolve, pReject) => {\n execFile('escript', [this.#path, ...parameters], (error, stdout, stderr) => {\n if (error != null) pReject(error);\n else if (stderr !== '') pReject(new CompilerError(stderr));\n else pResolve(stdout);\n });\n });\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(Object.entries(fileSystem)\n .map(async ([name, src]) => {\n const p = resolve(path, name);\n await mkdir(dirname(p), { recursive: true });\n return writeFile(p, src);\n }));\n return sourceCodePath;\n }\n\n async compile(path: string): Promise<{\n bytecode: Encoded.ContractBytearray;\n aci: Aci;\n }> {\n await this.#ensureCompatibleVersion;\n try {\n const [bytecode, aci] = await Promise.all([\n this.#run(path),\n this.#run('--create_json_aci', path).then((res) => JSON.parse(res)),\n ]);\n return {\n bytecode: bytecode.trimEnd() as Encoded.ContractBytearray,\n aci: aci as Aci,\n };\n } catch (error) {\n throw new CompilerError(error.message);\n }\n }\n\n async compileBySourceCode(sourceCode: string, fileSystem?: Record<string, string>): Promise<{\n bytecode: Encoded.ContractBytearray;\n aci: Aci;\n }> {\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 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,OAAAA,cAAA,MAAyB,eAAe;AAAC;EAAAC;AAAA,IAAAD,cAAA;AACzC,OAAAE,GAAA,MAAuB,IAAI;AAAC;EAAAC;AAAA,IAAAD,GAAA;AAC5B,OAAAE,KAAA,MAA2C,MAAM;AAAC;EAAAC,OAAA;EAAAC,OAAA;EAAAC;AAAA,IAAAH,KAAA;AAClD,OAAAI,WAAA,MAAqC,aAAa;AAAC;EAAAC,KAAA;EAAAC,SAAA;EAAAC;AAAA,IAAAH,WAAA;AACnD,OAAAI,IAAA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KAAK,CAACW,IAAI,CAAC;EACjB,MAAMkE,cAAc,GAAGjF,OAAO,CAACe,IAAI,EAAG,GAAE6D,UAAU,EAAG,MAAK,CAAC;EAC3D,MAAMvE,SAAS,CAAC4E,cAAc,EAAE1B,UAAU,CAAC;EAC3C,MAAMZ,OAAO,CAACC,GAAG,CAACsC,MAAM,CAACC,OAAO,CAAC3B,UAAU,CAAC,CACzC4B,GAAG,CAAC,MAAAC,IAAA,IAAuB;IAAA,IAAhB,CAACC,IAAI,EAAEC,GAAG,CAAC,GAAAF,IAAA;IACrB,MAAMG,CAAC,GAAGxF,OAAO,CAACe,IAAI,EAAEuE,IAAI,CAAC;IAC7B,MAAMlF,KAAK,CAACH,OAAO,CAACuF,CAAC,CAAC,EAAE;MAAE5B,SAAS,EAAE;IAAK,CAAC,CAAC;IAC5C,OAAOvD,SAAS,CAACmF,CAAC,EAAED,GAAG,CAAC;EAC1B,CAAC,CAAC,CAAC;EACL,OAAON,cAAc;AACvB"}
|
|
1
|
+
{"version":3,"file":"Cli.mjs","names":["_child_process","execFile","_os","tmpdir","_path","resolve","dirname","basename","_fsPromises","mkdir","writeFile","rm","_url","fileURLToPath","CompilerBase","CompilerError","InternalError","UnsupportedVersionError","semverSatisfies","ensureError","getPackagePath","path","import","meta","url","_path2","WeakMap","_ensureCompatibleVersion","_run","WeakSet","CompilerCli","constructor","compilerPath","arguments","length","undefined","ignoreVersion","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","writable","value","Promise","_classPrivateFieldSet","version","then","versions","compile","_classPrivateFieldGet","bytecode","aci","all","_classPrivateMethodGet","_run2","call","res","JSON","parse","trimEnd","error","message","compileBySourceCode","sourceCode","fileSystem","tmp","_classStaticPrivateMethodGet","_saveContractToTmpDir","recursive","generateAci","generateAciBySourceCode","validate","includes","validateBySourceCode","_verMessage$match","verMessage","ver","match","_len","parameters","Array","_key","pResolve","pReject","stdout","stderr","randomName","Math","random","toString","slice","sourceCodePath","Object","entries","map","_ref","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 } from './Base';\nimport { Encoded } from '../../utils/encoder';\nimport { CompilerError, InternalError, UnsupportedVersionError } from '../../utils/errors';\nimport semverSatisfies from '../../utils/semver-satisfies';\nimport { ensureError } from '../../utils/other';\n\nconst 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 * Assumes that `escript` is available in PATH.\n */\nexport default class CompilerCli extends CompilerBase {\n #path: string;\n\n #ensureCompatibleVersion = Promise.resolve();\n\n constructor(\n compilerPath = resolve(getPackagePath(), './bin/aesophia_cli'),\n { ignoreVersion }: { ignoreVersion?: boolean } = {},\n ) {\n super();\n this.#path = compilerPath;\n if (ignoreVersion !== true) {\n this.#ensureCompatibleVersion = this.version().then((version) => {\n const versions = [version, '7.2.1', '8.0.0'] as const;\n if (!semverSatisfies(...versions)) throw new UnsupportedVersionError('compiler', ...versions);\n });\n }\n }\n\n async #run(...parameters: string[]): Promise<string> {\n return new Promise((pResolve, pReject) => {\n execFile('escript', [this.#path, ...parameters], (error, stdout, stderr) => {\n if (error != null) pReject(error);\n else if (stderr !== '') pReject(new CompilerError(stderr));\n else pResolve(stdout);\n });\n });\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(Object.entries(fileSystem)\n .map(async ([name, src]) => {\n const p = resolve(path, name);\n await mkdir(dirname(p), { recursive: true });\n return writeFile(p, src);\n }));\n return sourceCodePath;\n }\n\n async compile(path: string): Promise<{\n bytecode: Encoded.ContractBytearray;\n aci: Aci;\n }> {\n await this.#ensureCompatibleVersion;\n try {\n const [bytecode, aci] = await Promise.all([\n this.#run(path),\n this.#run('--create_json_aci', path).then((res) => JSON.parse(res)),\n ]);\n return {\n bytecode: bytecode.trimEnd() as Encoded.ContractBytearray,\n aci,\n };\n } catch (error) {\n ensureError(error);\n throw new CompilerError(error.message);\n }\n }\n\n async compileBySourceCode(sourceCode: string, fileSystem?: Record<string, string>): Promise<{\n bytecode: Encoded.ContractBytearray;\n aci: Aci;\n }> {\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,OAAAA,cAAA,MAAyB,eAAe;AAAC;EAAAC;AAAA,IAAAD,cAAA;AACzC,OAAAE,GAAA,MAAuB,IAAI;AAAC;EAAAC;AAAA,IAAAD,GAAA;AAC5B,OAAAE,KAAA,MAA2C,MAAM;AAAC;EAAAC,OAAA;EAAAC,OAAA;EAAAC;AAAA,IAAAH,KAAA;AAClD,OAAAI,WAAA,MAAqC,aAAa;AAAC;EAAAC,KAAA;EAAAC,SAAA;EAAAC;AAAA,IAAAH,WAAA;AACnD,OAAAI,IAAA,MAA8B,KAAK;AAAC;EAAAC;AAAA,IAAAD,IAAA;AAAA,OAC7BE,YAAY;AAAA,SAEVC,aAAa,EAAEC,aAAa,EAAEC,uBAAuB;AAAA,OACvDC,eAAe;AAAA,SACbC,WAAW;AAEpB,MAAMC,cAAc,GAAGA,CAAA,KAAc;EACnC,MAAMC,IAAI,GAAGf,OAAO,CAACO,aAAa,CAACS,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;EACpD,IAAIjB,QAAQ,CAACc,IAAI,CAAC,KAAK,MAAM,EAAE,OAAOhB,OAAO,CAACgB,IAAI,EAAE,IAAI,CAAC;EACzD,IAAId,QAAQ,CAACc,IAAI,CAAC,KAAK,UAAU,EAAE,OAAOhB,OAAO,CAACgB,IAAI,EAAE,UAAU,CAAC;EACnE,MAAM,IAAIL,aAAa,CAAC,yBAAyB,CAAC;AACpD,CAAC;;AAED;AACA;AACA;AACA;AAHA,IAAAS,MAAA,oBAAAC,OAAA;AAAA,IAAAC,wBAAA,oBAAAD,OAAA;AAAA,IAAAE,IAAA,oBAAAC,OAAA;AAIA,eAAe,MAAMC,WAAW,SAAShB,YAAY,CAAC;EAKpDiB,WAAWA,CAAA,EAGT;IAAA,IAF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AC,CAACC,KAAK,CAAC,CAAC,CAAC;EACpE,MAAMnE,IAAI,GAAGhB,OAAO,CAACF,MAAM,EAAE,EAAG,eAAciF,UAAU,EAAG,EAAC,CAAC;EAC7D,MAAM3E,KAAK,CAACY,IAAI,CAAC;EACjB,MAAMoE,cAAc,GAAGpF,OAAO,CAACgB,IAAI,EAAG,GAAE+D,UAAU,EAAG,MAAK,CAAC;EAC3D,MAAM1E,SAAS,CAAC+E,cAAc,EAAE5B,UAAU,CAAC;EAC3C,MAAMpB,OAAO,CAACS,GAAG,CAACwC,MAAM,CAACC,OAAO,CAAC7B,UAAU,CAAC,CACzC8B,GAAG,CAAC,MAAAC,IAAA,IAAuB;IAAA,IAAhB,CAACC,IAAI,EAAEC,GAAG,CAAC,GAAAF,IAAA;IACrB,MAAMG,CAAC,GAAG3F,OAAO,CAACgB,IAAI,EAAEyE,IAAI,CAAC;IAC7B,MAAMrF,KAAK,CAACH,OAAO,CAAC0F,CAAC,CAAC,EAAE;MAAE9B,SAAS,EAAE;IAAK,CAAC,CAAC;IAC5C,OAAOxD,SAAS,CAACsF,CAAC,EAAED,GAAG,CAAC;EAC1B,CAAC,CAAC,CAAC;EACL,OAAON,cAAc;AACvB"}
|
|
@@ -26,6 +26,8 @@ export default class CompilerHttp extends CompilerBase {
|
|
|
26
26
|
bytecode: Encoded.ContractBytearray;
|
|
27
27
|
aci: Aci;
|
|
28
28
|
}>;
|
|
29
|
+
generateAciBySourceCode(sourceCode: string, fileSystem?: Record<string, string>): Promise<Aci>;
|
|
30
|
+
generateAci(path: string): Promise<Aci>;
|
|
29
31
|
validateBySourceCode(bytecode: Encoded.ContractBytearray, sourceCode: string, fileSystem?: Record<string, string>): Promise<boolean>;
|
|
30
32
|
validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean>;
|
|
31
33
|
version(): Promise<string>;
|
|
@@ -43,7 +43,7 @@ export default class CompilerHttp extends CompilerBase {
|
|
|
43
43
|
} = _ref;
|
|
44
44
|
return apiVersion;
|
|
45
45
|
}, error => error);
|
|
46
|
-
this.api.pipeline.addPolicy(genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.
|
|
46
|
+
this.api.pipeline.addPolicy(genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.3.0', '8.0.0'));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
async compileBySourceCode(sourceCode, fileSystem) {
|
|
@@ -58,7 +58,7 @@ export default class CompilerHttp extends CompilerBase {
|
|
|
58
58
|
return res;
|
|
59
59
|
} catch (error) {
|
|
60
60
|
if (error instanceof RestError && error.statusCode === 400) {
|
|
61
|
-
throw new CompilerError(error.message
|
|
61
|
+
throw new CompilerError(error.message);
|
|
62
62
|
}
|
|
63
63
|
throw error;
|
|
64
64
|
}
|
|
@@ -68,6 +68,26 @@ export default class CompilerHttp extends CompilerBase {
|
|
|
68
68
|
async compile(path) {
|
|
69
69
|
throw new NotImplementedError('File system access, use CompilerHttpNode instead');
|
|
70
70
|
}
|
|
71
|
+
async generateAciBySourceCode(sourceCode, fileSystem) {
|
|
72
|
+
try {
|
|
73
|
+
return await this.api.generateACI({
|
|
74
|
+
code: sourceCode,
|
|
75
|
+
options: {
|
|
76
|
+
fileSystem
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (error instanceof RestError && error.statusCode === 400) {
|
|
81
|
+
throw new CompilerError(error.message);
|
|
82
|
+
}
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
88
|
+
async generateAci(path) {
|
|
89
|
+
throw new NotImplementedError('File system access, use CompilerHttpNode instead');
|
|
90
|
+
}
|
|
71
91
|
async validateBySourceCode(bytecode, sourceCode, fileSystem) {
|
|
72
92
|
try {
|
|
73
93
|
await this.api.validateByteCode({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Http.mjs","names":["RestError","Compiler","CompilerApi","genErrorFormatterPolicy","genVersionCheckPolicy","CompilerBase","CompilerError","NotImplementedError","CompilerHttp","constructor","compilerUrl","ignoreVersion","arguments","length","undefined","api","allowInsecureConnection","additionalPolicies","body","message","reason","parameter","info","JSON","stringify","Array","isArray","map","e","type","pos","line","col","context","join","versionPromise","apiVersion","then","_ref","error","pipeline","addPolicy","compileBySourceCode","sourceCode","fileSystem","res","compileContract","code","options","statusCode","
|
|
1
|
+
{"version":3,"file":"Http.mjs","names":["RestError","Compiler","CompilerApi","genErrorFormatterPolicy","genVersionCheckPolicy","CompilerBase","CompilerError","NotImplementedError","CompilerHttp","constructor","compilerUrl","ignoreVersion","arguments","length","undefined","api","allowInsecureConnection","additionalPolicies","body","message","reason","parameter","info","JSON","stringify","Array","isArray","map","e","type","pos","line","col","context","join","versionPromise","apiVersion","then","_ref","error","pipeline","addPolicy","compileBySourceCode","sourceCode","fileSystem","res","compileContract","code","options","statusCode","compile","path","generateAciBySourceCode","generateACI","generateAci","validateBySourceCode","bytecode","validateByteCode","source","validate","version"],"sources":["../../../src/contract/compiler/Http.ts"],"sourcesContent":["import { RestError } from '@azure/core-rest-pipeline';\nimport {\n Compiler as CompilerApi,\n ErrorModel,\n CompilerError as CompilerErrorApi,\n} from '../../apis/compiler';\nimport { genErrorFormatterPolicy, genVersionCheckPolicy } from '../../utils/autorest';\nimport CompilerBase, { Aci } from './Base';\nimport { Encoded } from '../../utils/encoder';\nimport { CompilerError, NotImplementedError } from '../../utils/errors';\n\ntype GeneralCompilerError = ErrorModel & {\n info?: object;\n parameter?: string;\n};\n\n/**\n * Contract Compiler over HTTP\n *\n * This class include api call's related to contract compiler functionality.\n * @category contract\n * @example CompilerHttp('COMPILER_URL')\n */\nexport default class CompilerHttp extends CompilerBase {\n readonly api: CompilerApi;\n\n /**\n * @param compilerUrl - Url for compiler API\n * @param options - Options\n * @param options.ignoreVersion - Don't check compiler version\n */\n constructor(compilerUrl: string, { ignoreVersion }: { ignoreVersion?: boolean } = {}) {\n super();\n this.api = new CompilerApi(compilerUrl, {\n allowInsecureConnection: true,\n additionalPolicies: [\n genErrorFormatterPolicy((body: GeneralCompilerError | CompilerErrorApi[]) => {\n let message = '';\n if ('reason' in body) {\n message += ` ${body.reason\n }${body.parameter != null ? ` in ${body.parameter}` : ''\n // TODO: revising after improving documentation https://github.com/aeternity/aesophia_http/issues/78\n }${body.info != null ? ` (${JSON.stringify(body.info)})` : ''}`;\n }\n if (Array.isArray(body)) {\n message += `\\n${body\n .map((e) => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context != null ? ` (${e.context})` : ''}`)\n .join('\\n')}`;\n }\n return message;\n }),\n ],\n });\n if (ignoreVersion !== true) {\n const versionPromise = this.api.apiVersion()\n .then(({ apiVersion }) => apiVersion, (error) => error);\n this.api.pipeline.addPolicy(\n genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.3.0', '8.0.0'),\n );\n }\n }\n\n async compileBySourceCode(\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<{ bytecode: Encoded.ContractBytearray; aci: Aci }> {\n try {\n const res = await this.api.compileContract({ code: sourceCode, options: { fileSystem } });\n // TODO: should be fixed when the compiledAci interface gets updated\n return res as { bytecode: Encoded.ContractBytearray; aci: Aci };\n } catch (error) {\n if (error instanceof RestError && error.statusCode === 400) {\n throw new CompilerError(error.message);\n }\n throw error;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n async compile(path: string): Promise<{ bytecode: Encoded.ContractBytearray; aci: Aci }> {\n throw new NotImplementedError('File system access, use CompilerHttpNode instead');\n }\n\n async generateAciBySourceCode(\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<Aci> {\n try {\n return await this.api.generateACI({ code: sourceCode, options: { fileSystem } });\n } catch (error) {\n if (error instanceof RestError && error.statusCode === 400) {\n throw new CompilerError(error.message);\n }\n throw error;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n async generateAci(path: string): Promise<Aci> {\n throw new NotImplementedError('File system access, use CompilerHttpNode instead');\n }\n\n async validateBySourceCode(\n bytecode: Encoded.ContractBytearray,\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<boolean> {\n try {\n await this.api.validateByteCode({ bytecode, source: sourceCode, options: { fileSystem } });\n return true;\n } catch {\n return false;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n async validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean> {\n throw new NotImplementedError('File system access, use CompilerHttpNode instead');\n }\n\n async version(): Promise<string> {\n return (await this.api.version()).version;\n }\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,2BAA2B;AAAC,SAEpDC,QAAQ,IAAIC,WAAW;AAAA,SAIhBC,uBAAuB,EAAEC,qBAAqB;AAAA,OAChDC,YAAY;AAAA,SAEVC,aAAa,EAAEC,mBAAmB;AAO3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,YAAY,SAASH,YAAY,CAAC;EAGrD;AACF;AACA;AACA;AACA;EACEI,WAAWA,CAACC,WAAmB,EAAuD;IAAA,IAArD;MAAEC;IAA2C,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAClF,KAAK,EAAE;IACP,IAAI,CAACG,GAAG,GAAG,IAAIb,WAAW,CAACQ,WAAW,EAAE;MACtCM,uBAAuB,EAAE,IAAI;MAC7BC,kBAAkB,EAAE,CAClBd,uBAAuB,CAAEe,IAA+C,IAAK;QAC3E,IAAIC,OAAO,GAAG,EAAE;QAChB,IAAI,QAAQ,IAAID,IAAI,EAAE;UACpBC,OAAO,IAAK,IAAGD,IAAI,CAACE,MACnB,GAAEF,IAAI,CAACG,SAAS,IAAI,IAAI,GAAI,OAAMH,IAAI,CAACG,SAAU,EAAC,GAAG;UACpD;UACD,GAAEH,I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AoB;IAC/B,OAAO,CAAC,MAAM,IAAI,CAAC7C,GAAG,CAAC6C,OAAO,EAAE,EAAEA,OAAO;EAC3C;AACF"}
|
|
@@ -17,6 +17,11 @@ export default class CompilerHttpNode extends HttpBrowser {
|
|
|
17
17
|
const sourceCode = await readFile(path, 'utf8');
|
|
18
18
|
return this.compileBySourceCode(sourceCode, fileSystem);
|
|
19
19
|
}
|
|
20
|
+
async generateAci(path) {
|
|
21
|
+
const fileSystem = await getFileSystem(path);
|
|
22
|
+
const sourceCode = await readFile(path, 'utf8');
|
|
23
|
+
return this.generateAciBySourceCode(sourceCode, fileSystem);
|
|
24
|
+
}
|
|
20
25
|
async validate(bytecode, path) {
|
|
21
26
|
const fileSystem = await getFileSystem(path);
|
|
22
27
|
const sourceCode = await readFile(path, 'utf8');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpNode.mjs","names":["_fsPromises","readFile","HttpBrowser","getFileSystem","CompilerHttpNode","compile","path","fileSystem","sourceCode","compileBySourceCode","validate","bytecode","validateBySourceCode"],"sources":["../../../src/contract/compiler/HttpNode.ts"],"sourcesContent":["import { readFile } from 'fs/promises';\nimport HttpBrowser from './Http';\nimport { Aci } from './Base';\nimport { Encoded } from '../../utils/encoder';\nimport getFileSystem from './getFileSystem';\n\n/**\n * Contract Compiler over HTTP for Nodejs\n *\n * Inherits CompilerHttp and implements `compile`, `validate` methods\n * @category contract\n * @example CompilerHttpNode('COMPILER_URL')\n */\nexport default class CompilerHttpNode extends HttpBrowser {\n override async compile(path: string): Promise<{ bytecode: Encoded.ContractBytearray; aci: Aci }> {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.compileBySourceCode(sourceCode, fileSystem);\n }\n\n override async validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean> {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.validateBySourceCode(bytecode, sourceCode, fileSystem);\n }\n}\n"],"mappings":"AAAA,OAAAA,WAAA,MAAyB,aAAa;AAAC;EAAAC;AAAA,IAAAD,WAAA;AAAA,OAChCE,WAAW;AAAA,OAGXC,aAAa;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,WAAW,CAAC;EACxD,MAAeG,OAAOA,CAACC,IAAY,EAA8D;IAC/F,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMP,QAAQ,CAACK,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACG,mBAAmB,CAACD,UAAU,EAAED,UAAU,CAAC;EACzD;EAEA,MAAeG,QAAQA,CAACC,QAAmC,
|
|
1
|
+
{"version":3,"file":"HttpNode.mjs","names":["_fsPromises","readFile","HttpBrowser","getFileSystem","CompilerHttpNode","compile","path","fileSystem","sourceCode","compileBySourceCode","generateAci","generateAciBySourceCode","validate","bytecode","validateBySourceCode"],"sources":["../../../src/contract/compiler/HttpNode.ts"],"sourcesContent":["import { readFile } from 'fs/promises';\nimport HttpBrowser from './Http';\nimport { Aci } from './Base';\nimport { Encoded } from '../../utils/encoder';\nimport getFileSystem from './getFileSystem';\n\n/**\n * Contract Compiler over HTTP for Nodejs\n *\n * Inherits CompilerHttp and implements `compile`, `validate` methods\n * @category contract\n * @example CompilerHttpNode('COMPILER_URL')\n */\nexport default class CompilerHttpNode extends HttpBrowser {\n override async compile(path: string): Promise<{ bytecode: Encoded.ContractBytearray; aci: Aci }> {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.compileBySourceCode(sourceCode, fileSystem);\n }\n\n override async generateAci(path: string): Promise<Aci> {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.generateAciBySourceCode(sourceCode, fileSystem);\n }\n\n override async validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean> {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.validateBySourceCode(bytecode, sourceCode, fileSystem);\n }\n}\n"],"mappings":"AAAA,OAAAA,WAAA,MAAyB,aAAa;AAAC;EAAAC;AAAA,IAAAD,WAAA;AAAA,OAChCE,WAAW;AAAA,OAGXC,aAAa;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,WAAW,CAAC;EACxD,MAAeG,OAAOA,CAACC,IAAY,EAA8D;IAC/F,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMP,QAAQ,CAACK,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACG,mBAAmB,CAACD,UAAU,EAAED,UAAU,CAAC;EACzD;EAEA,MAAeG,WAAWA,CAACJ,IAAY,EAAgB;IACrD,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMP,QAAQ,CAACK,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACK,uBAAuB,CAACH,UAAU,EAAED,UAAU,CAAC;EAC7D;EAEA,MAAeK,QAAQA,CAACC,QAAmC,EAAEP,IAAY,EAAoB;IAC3F,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMP,QAAQ,CAACK,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACQ,oBAAoB,CAACD,QAAQ,EAAEL,UAAU,EAAED,UAAU,CAAC;EACpE;AACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RpcError } from './aepp-wallet-communication/schema';
|
|
2
|
+
/**
|
|
3
|
+
* @category exception
|
|
4
|
+
* @deprecated this exception is not thrown anymore
|
|
5
|
+
*/
|
|
6
|
+
export declare class RpcBroadcastError extends RpcError {
|
|
7
|
+
static code: number;
|
|
8
|
+
code: number;
|
|
9
|
+
constructor(data?: any);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use isAuctionName instead
|
|
13
|
+
*/
|
|
14
|
+
export declare const NAME_BID_MAX_LENGTH = 12;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
|
+
import { RpcError } from "./aepp-wallet-communication/schema.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* @category exception
|
|
5
|
+
* @deprecated this exception is not thrown anymore
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
8
|
+
export class RpcBroadcastError extends RpcError {
|
|
9
|
+
constructor(data) {
|
|
10
|
+
super('Broadcast failed');
|
|
11
|
+
_defineProperty(this, "code", 3);
|
|
12
|
+
this.data = data;
|
|
13
|
+
this.name = 'RpcBroadcastError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated use isAuctionName instead
|
|
19
|
+
*/
|
|
20
|
+
_defineProperty(RpcBroadcastError, "code", 3);
|
|
21
|
+
export const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid
|
|
22
|
+
//# sourceMappingURL=deprecated.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecated.mjs","names":["RpcError","RpcBroadcastError","constructor","data","_defineProperty","name","NAME_BID_MAX_LENGTH"],"sources":["../src/deprecated.ts"],"sourcesContent":["import { RpcError } from './aepp-wallet-communication/schema';\n\n/**\n * @category exception\n * @deprecated this exception is not thrown anymore\n */\n// eslint-disable-next-line import/prefer-default-export\nexport class RpcBroadcastError extends RpcError {\n static override code = 3;\n\n override code = 3;\n\n constructor(data?: any) {\n super('Broadcast failed');\n this.data = data;\n this.name = 'RpcBroadcastError';\n }\n}\n\n/**\n * @deprecated use isAuctionName instead\n */\nexport const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid\n"],"mappings":";SAASA,QAAQ;AAEjB;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,SAASD,QAAQ,CAAC;EAK9CE,WAAWA,CAACC,IAAU,EAAE;IACtB,KAAK,CAAC,kBAAkB,CAAC;IAACC,eAAA,eAHZ,CAAC;IAIf,IAAI,CAACD,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACE,IAAI,GAAG,mBAAmB;EACjC;AACF;;AAEA;AACA;AACA;AAFAD,eAAA,CAZaH,iBAAiB,UACL,CAAC;AAc1B,OAAO,MAAMK,mBAAmB,GAAG,EAAE,CAAC,CAAC"}
|
package/es/index-browser.d.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export { _getPollInterval, InvalidTxError, getHeight, poll, awaitHeight, waitForTxConfirm, sendTransaction, getAccount, getBalance, getCurrentGeneration, getGeneration, getMicroBlockTransactions, getKeyBlock, getMicroBlockHeader, txDryRun, getContractByteCode, getContract, getName, resolveName, } from './chain';
|
|
2
|
+
export { getAddressFromPriv, isAddressValid, genSalt, encodeUnsigned, hash, encodeContractAddress, generateKeyPairFromSecret, generateKeyPair, sign, verify, messageToHash, signMessage, verifyMessage, isValidKeypair, } from './utils/crypto';
|
|
3
|
+
export { recover, dump } from './utils/keystore';
|
|
4
|
+
export type { Keystore } from './utils/keystore';
|
|
5
|
+
export { toBytes } from './utils/bytes';
|
|
5
6
|
export { buildTx, buildTxAsync, buildTxHash, unpackTx, buildContractIdByContractTx, } from './tx/builder';
|
|
6
|
-
export
|
|
7
|
-
export
|
|
7
|
+
export { buildContractId, oracleQueryId, produceNameId, commitmentHash, readInt, isNameValid, ensureName, getDefaultPointerKey, getMinimumNameFee, computeBidFee, computeAuctionEndBlock, isAuctionName, } from './tx/builder/helpers';
|
|
8
|
+
export { MAX_AUTH_FUN_GAS, NAME_TTL, NAME_MAX_TTL, NAME_MAX_CLIENT_TTL, CLIENT_TTL, MIN_GAS_PRICE, NAME_FEE_MULTIPLIER, NAME_FEE_BID_INCREMENT, NAME_BID_TIMEOUT_BLOCKS, NAME_MAX_LENGTH_FEE, NAME_BID_RANGES, ConsensusProtocolVersion, VmVersion, AbiVersion, Tag, } from './tx/builder/constants';
|
|
9
|
+
export type { Int, AensName } from './tx/builder/constants';
|
|
8
10
|
export { ORACLE_TTL_TYPES, ORACLE_TTL, QUERY_TTL, RESPONSE_TTL, DRY_RUN_ACCOUNT, CallReturnType, } from './tx/builder/schema';
|
|
9
11
|
export { getExecutionCost, getExecutionCostBySignedTx, getExecutionCostUsingNode, } from './tx/execution-cost';
|
|
10
12
|
export { default as getTransactionSignerAddress } from './tx/transaction-signer';
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
+
export { AE_AMOUNT_FORMATS, formatAmount, toAe, toAettos, prefixedAmount, } from './utils/amount-formatter';
|
|
14
|
+
export { DerivationError, deriveChild, derivePathFromKey, getMasterKeyFromSeed, derivePathFromSeed, getKeyPair, generateSaveHDWalletFromSeed, getSaveHDWalletAccounts, getHdWalletAccountFromSeed, } from './utils/hd-wallet';
|
|
13
15
|
export { encode, decode, Encoding, Encoded, } from './utils/encoder';
|
|
14
|
-
export
|
|
16
|
+
export { encodeFateValue, decodeFateValue, hashTypedData, hashDomain, hashJson, } from './utils/typed-data';
|
|
17
|
+
export { aensRevoke, aensUpdate, aensTransfer, aensQuery, aensClaim, aensPreclaim, aensBid, } from './aens';
|
|
15
18
|
export { default as Contract } from './contract/Contract';
|
|
16
19
|
export type { ContractMethodsBase } from './contract/Contract';
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
+
export { pollForQueries, pollForQueryResponse, getQueryObject, postQueryToOracle, extendOracleTtl, respondToQuery, getOracleObject, registerOracle, } from './oracle';
|
|
21
|
+
export { spend, transferFunds, payForTransaction } from './spend';
|
|
22
|
+
export { createGeneralizedAccount, buildAuthTxHash, buildAuthTxHashByGaMetaTx } from './contract/ga';
|
|
20
23
|
export { default as AeSdkMethods } from './AeSdkMethods';
|
|
21
24
|
export { default as AeSdkBase } from './AeSdkBase';
|
|
22
25
|
export { default as AeSdk } from './AeSdk';
|
|
@@ -32,9 +35,12 @@ export { default as AccountLedgerFactory } from './account/LedgerFactory';
|
|
|
32
35
|
export { default as CompilerBase } from './contract/compiler/Base';
|
|
33
36
|
export { default as CompilerHttp } from './contract/compiler/Http';
|
|
34
37
|
export { default as Channel } from './channel/Contract';
|
|
38
|
+
export { default as _MiddlewareSubscriber, MiddlewareSubscriberError as _MiddlewareSubscriberError, MiddlewareSubscriberDisconnected as _MiddlewareSubscriberDisconnected, } from './MiddlewareSubscriber';
|
|
39
|
+
export { default as _Middleware } from './Middleware';
|
|
35
40
|
export { default as connectionProxy } from './aepp-wallet-communication/connection-proxy';
|
|
36
|
-
export
|
|
41
|
+
export { MESSAGE_DIRECTION, WALLET_TYPE, SUBSCRIPTION_TYPES, METHODS, RPC_STATUS, RpcError, RpcInvalidTransactionError, RpcRejectedByUserError, RpcUnsupportedProtocolError, RpcConnectionDenyError, RpcNotAuthorizeError, RpcPermissionDenyError, RpcInternalError, RpcMethodNotFoundError, } from './aepp-wallet-communication/schema';
|
|
37
42
|
export { default as walletDetector } from './aepp-wallet-communication/wallet-detector';
|
|
38
43
|
export { default as BrowserRuntimeConnection } from './aepp-wallet-communication/connection/BrowserRuntime';
|
|
39
44
|
export { default as BrowserWindowMessageConnection } from './aepp-wallet-communication/connection/BrowserWindowMessage';
|
|
40
|
-
export
|
|
45
|
+
export { BaseError, AccountError, AensError, AeppError, ChannelError, CompilerError, ContractError, CryptographyError, NodeError, TransactionError, WalletError, ArgumentError, IllegalArgumentError, ArgumentCountMismatchError, InsufficientBalanceError, MissingParamError, NoSerializerFoundError, RequestTimedOutError, TxTimedOutError, TypeError, UnsupportedPlatformError, UnsupportedProtocolError, NotImplementedError, UnsupportedVersionError, InternalError, UnexpectedTsError, UnavailableAccountError, AensPointerContextError, InsufficientNameFeeError, InvalidAensNameError, InvalidRpcMessageError, MissingCallbackError, UnAuthorizedAccountError, UnknownRpcClientError, UnsubscribedAccountError, ChannelCallError, ChannelConnectionError, ChannelPingTimedOutError, UnexpectedChannelMessageError, ChannelIncomingMessageError, UnknownChannelStateError, InvalidAuthDataError, BytecodeMismatchError, DuplicateContractError, InactiveContractError, InvalidMethodInvocationError, MissingContractAddressError, MissingContractDefError, MissingFunctionNameError, NodeInvocationError, NoSuchContractFunctionError, NotPayableFunctionError, MissingEventDefinitionError, AmbiguousEventDefinitionError, InvalidChecksumError, InvalidPasswordError, MerkleTreeHashMismatchError, MissingNodeInTreeError, UnknownNodeLengthError, UnknownPathNibbleError, DuplicateNodeError, NodeNotFoundError, DecodeError, PayloadLengthError, DryRunError, IllegalBidFeeError, InvalidSignatureError, PrefixNotFoundError, SchemaNotFoundError, TagNotFoundError, TxNotInChainError, AlreadyConnectedError, NoWalletConnectedError, RpcConnectionError, } from './utils/errors';
|
|
46
|
+
export { RpcBroadcastError, NAME_BID_MAX_LENGTH } from './deprecated';
|
package/es/index-browser.mjs
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export * from "./utils/bytes.mjs";
|
|
1
|
+
export { _getPollInterval, InvalidTxError, getHeight, poll, awaitHeight, waitForTxConfirm, sendTransaction, getAccount, getBalance, getCurrentGeneration, getGeneration, getMicroBlockTransactions, getKeyBlock, getMicroBlockHeader, txDryRun, getContractByteCode, getContract, getName, resolveName } from "./chain.mjs";
|
|
2
|
+
export { getAddressFromPriv, isAddressValid, genSalt, encodeUnsigned, hash, encodeContractAddress, generateKeyPairFromSecret, generateKeyPair, sign, verify, messageToHash, signMessage, verifyMessage, isValidKeypair } from "./utils/crypto.mjs";
|
|
3
|
+
export { recover, dump } from "./utils/keystore.mjs";
|
|
4
|
+
export { toBytes } from "./utils/bytes.mjs";
|
|
6
5
|
export { buildTx, buildTxAsync, buildTxHash, unpackTx, buildContractIdByContractTx } from "./tx/builder/index.mjs";
|
|
7
|
-
export
|
|
8
|
-
export
|
|
6
|
+
export { buildContractId, oracleQueryId, produceNameId, commitmentHash, readInt, isNameValid, ensureName, getDefaultPointerKey, getMinimumNameFee, computeBidFee, computeAuctionEndBlock, isAuctionName } from "./tx/builder/helpers.mjs";
|
|
7
|
+
export { MAX_AUTH_FUN_GAS, NAME_TTL, NAME_MAX_TTL, NAME_MAX_CLIENT_TTL, CLIENT_TTL, MIN_GAS_PRICE, NAME_FEE_MULTIPLIER, NAME_FEE_BID_INCREMENT, NAME_BID_TIMEOUT_BLOCKS, NAME_MAX_LENGTH_FEE, NAME_BID_RANGES, ConsensusProtocolVersion, VmVersion, AbiVersion, Tag } from "./tx/builder/constants.mjs";
|
|
8
|
+
// TODO: move to constants
|
|
9
9
|
export { ORACLE_TTL_TYPES, ORACLE_TTL, QUERY_TTL, RESPONSE_TTL, DRY_RUN_ACCOUNT, CallReturnType } from "./tx/builder/schema.mjs";
|
|
10
10
|
export { getExecutionCost, getExecutionCostBySignedTx, getExecutionCostUsingNode } from "./tx/execution-cost.mjs";
|
|
11
11
|
export { default as getTransactionSignerAddress } from "./tx/transaction-signer.mjs";
|
|
12
|
-
export
|
|
13
|
-
export
|
|
12
|
+
export { AE_AMOUNT_FORMATS, formatAmount, toAe, toAettos, prefixedAmount } from "./utils/amount-formatter.mjs";
|
|
13
|
+
export { DerivationError, deriveChild, derivePathFromKey, getMasterKeyFromSeed, derivePathFromSeed, getKeyPair, generateSaveHDWalletFromSeed, getSaveHDWalletAccounts, getHdWalletAccountFromSeed } from "./utils/hd-wallet.mjs";
|
|
14
14
|
export { encode, decode, Encoding, Encoded } from "./utils/encoder.mjs";
|
|
15
|
-
export
|
|
15
|
+
export { encodeFateValue, decodeFateValue, hashTypedData, hashDomain, hashJson } from "./utils/typed-data.mjs";
|
|
16
|
+
export { aensRevoke, aensUpdate, aensTransfer, aensQuery, aensClaim, aensPreclaim, aensBid } from "./aens.mjs";
|
|
16
17
|
export { default as Contract } from "./contract/Contract.mjs";
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
18
|
+
export { pollForQueries, pollForQueryResponse, getQueryObject, postQueryToOracle, extendOracleTtl, respondToQuery, getOracleObject, registerOracle } from "./oracle.mjs";
|
|
19
|
+
export { spend, transferFunds, payForTransaction } from "./spend.mjs";
|
|
20
|
+
export { createGeneralizedAccount, buildAuthTxHash, buildAuthTxHashByGaMetaTx } from "./contract/ga.mjs";
|
|
20
21
|
export { default as AeSdkMethods } from "./AeSdkMethods.mjs";
|
|
21
22
|
export { default as AeSdkBase } from "./AeSdkBase.mjs";
|
|
22
23
|
export { default as AeSdk } from "./AeSdk.mjs";
|
|
@@ -32,10 +33,13 @@ export { default as AccountLedgerFactory } from "./account/LedgerFactory.mjs";
|
|
|
32
33
|
export { default as CompilerBase } from "./contract/compiler/Base.mjs";
|
|
33
34
|
export { default as CompilerHttp } from "./contract/compiler/Http.mjs";
|
|
34
35
|
export { default as Channel } from "./channel/Contract.mjs";
|
|
36
|
+
export { default as _MiddlewareSubscriber, MiddlewareSubscriberError as _MiddlewareSubscriberError, MiddlewareSubscriberDisconnected as _MiddlewareSubscriberDisconnected } from "./MiddlewareSubscriber.mjs";
|
|
37
|
+
export { default as _Middleware } from "./Middleware.mjs";
|
|
35
38
|
export { default as connectionProxy } from "./aepp-wallet-communication/connection-proxy.mjs";
|
|
36
|
-
export
|
|
39
|
+
export { MESSAGE_DIRECTION, WALLET_TYPE, SUBSCRIPTION_TYPES, METHODS, RPC_STATUS, RpcError, RpcInvalidTransactionError, RpcRejectedByUserError, RpcUnsupportedProtocolError, RpcConnectionDenyError, RpcNotAuthorizeError, RpcPermissionDenyError, RpcInternalError, RpcMethodNotFoundError } from "./aepp-wallet-communication/schema.mjs";
|
|
37
40
|
export { default as walletDetector } from "./aepp-wallet-communication/wallet-detector.mjs";
|
|
38
41
|
export { default as BrowserRuntimeConnection } from "./aepp-wallet-communication/connection/BrowserRuntime.mjs";
|
|
39
42
|
export { default as BrowserWindowMessageConnection } from "./aepp-wallet-communication/connection/BrowserWindowMessage.mjs";
|
|
40
|
-
export
|
|
43
|
+
export { BaseError, AccountError, AensError, AeppError, ChannelError, CompilerError, ContractError, CryptographyError, NodeError, TransactionError, WalletError, ArgumentError, IllegalArgumentError, ArgumentCountMismatchError, InsufficientBalanceError, MissingParamError, NoSerializerFoundError, RequestTimedOutError, TxTimedOutError, TypeError, UnsupportedPlatformError, UnsupportedProtocolError, NotImplementedError, UnsupportedVersionError, InternalError, UnexpectedTsError, UnavailableAccountError, AensPointerContextError, InsufficientNameFeeError, InvalidAensNameError, InvalidRpcMessageError, MissingCallbackError, UnAuthorizedAccountError, UnknownRpcClientError, UnsubscribedAccountError, ChannelCallError, ChannelConnectionError, ChannelPingTimedOutError, UnexpectedChannelMessageError, ChannelIncomingMessageError, UnknownChannelStateError, InvalidAuthDataError, BytecodeMismatchError, DuplicateContractError, InactiveContractError, InvalidMethodInvocationError, MissingContractAddressError, MissingContractDefError, MissingFunctionNameError, NodeInvocationError, NoSuchContractFunctionError, NotPayableFunctionError, MissingEventDefinitionError, AmbiguousEventDefinitionError, InvalidChecksumError, InvalidPasswordError, MerkleTreeHashMismatchError, MissingNodeInTreeError, UnknownNodeLengthError, UnknownPathNibbleError, DuplicateNodeError, NodeNotFoundError, DecodeError, PayloadLengthError, DryRunError, IllegalBidFeeError, InvalidSignatureError, PrefixNotFoundError, SchemaNotFoundError, TagNotFoundError, TxNotInChainError, AlreadyConnectedError, NoWalletConnectedError, RpcConnectionError } from "./utils/errors.mjs";
|
|
44
|
+
export { RpcBroadcastError, NAME_BID_MAX_LENGTH } from "./deprecated.mjs";
|
|
41
45
|
//# sourceMappingURL=index-browser.mjs.map
|
package/es/index-browser.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-browser.mjs","names":["buildTx","buildTxAsync","buildTxHash","unpackTx","buildContractIdByContractTx","ORACLE_TTL_TYPES","ORACLE_TTL","QUERY_TTL","RESPONSE_TTL","DRY_RUN_ACCOUNT","CallReturnType","getExecutionCost","getExecutionCostBySignedTx","getExecutionCostUsingNode","default","getTransactionSignerAddress","encode","decode","Encoding","Encoded","Contract","AeSdkMethods","AeSdkBase","AeSdk","AeSdkAepp","AeSdkWallet","Node","verifyTransaction","AccountBase","MemoryAccount","AccountGeneralized","AccountLedger","AccountLedgerFactory","CompilerBase","CompilerHttp","Channel","connectionProxy","walletDetector","BrowserRuntimeConnection","BrowserWindowMessageConnection"],"sources":["../src/index-browser.ts"],"sourcesContent":["// TODO: avoid `export * from`\nexport * from './chain';\nexport * from './utils/crypto';\nexport * from './utils/keystore';\nexport * from './utils/bytes';\nexport {\n buildTx, buildTxAsync, buildTxHash, unpackTx, buildContractIdByContractTx,\n} from './tx/builder';\nexport * from './tx/builder/helpers';\nexport * from './tx/builder/constants';\n// TODO: move to constants\nexport {\n ORACLE_TTL_TYPES, ORACLE_TTL, QUERY_TTL, RESPONSE_TTL, DRY_RUN_ACCOUNT, CallReturnType,\n} from './tx/builder/schema';\nexport {\n getExecutionCost, getExecutionCostBySignedTx, getExecutionCostUsingNode,\n} from './tx/execution-cost';\nexport { default as getTransactionSignerAddress } from './tx/transaction-signer';\nexport * from './utils/amount-formatter';\nexport * from './utils/hd-wallet';\nexport {\n encode, decode, Encoding, Encoded,\n} from './utils/encoder';\nexport * from './aens';\nexport { default as Contract } from './contract/Contract';\nexport type { ContractMethodsBase } from './contract/Contract';\nexport * from './oracle';\nexport * from './spend';\nexport * from './contract/ga';\n\nexport { default as AeSdkMethods } from './AeSdkMethods';\nexport { default as AeSdkBase } from './AeSdkBase';\nexport { default as AeSdk } from './AeSdk';\nexport { default as AeSdkAepp } from './AeSdkAepp';\nexport { default as AeSdkWallet } from './AeSdkWallet';\nexport { default as Node } from './Node';\nexport { default as verifyTransaction } from './tx/validator';\nexport { default as AccountBase } from './account/Base';\nexport { default as MemoryAccount } from './account/Memory';\nexport { default as AccountGeneralized } from './account/Generalized';\nexport { default as AccountLedger } from './account/Ledger';\nexport { default as AccountLedgerFactory } from './account/LedgerFactory';\nexport { default as CompilerBase } from './contract/compiler/Base';\nexport { default as CompilerHttp } from './contract/compiler/Http';\nexport { default as Channel } from './channel/Contract';\n\nexport { default as connectionProxy } from './aepp-wallet-communication/connection-proxy';\nexport * from './aepp-wallet-communication/schema';\nexport { default as walletDetector } from './aepp-wallet-communication/wallet-detector';\nexport { default as BrowserRuntimeConnection } from './aepp-wallet-communication/connection/BrowserRuntime';\nexport { default as BrowserWindowMessageConnection } from './aepp-wallet-communication/connection/BrowserWindowMessage';\nexport * from './utils/errors';\n"],"mappings":"AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAMEA,OAAO,EAAEC,YAAY,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,2BAA2B;AAAA;AAAA,4CAI3E;AAAA,SAEEC,gBAAgB,EAAEC,UAAU,EAAEC,SAAS,EAAEC,YAAY,EAAEC,eAAe,EAAEC,cAAc;AAAA,SAGtFC,gBAAgB,EAAEC,0BAA0B,EAAEC,yBAAyB;AAAA,SAEhEC,OAAO,IAAIC,2BAA2B;AAAA;AAAA;AAAA,SAI7CC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO;AAAA;AAAA,SAG1BL,OAAO,IAAIM,QAAQ;AAAA;AAAA;AAAA;AAAA,SAMnBN,OAAO,IAAIO,YAAY;AAAA,SACvBP,OAAO,IAAIQ,SAAS;AAAA,SACpBR,OAAO,IAAIS,KAAK;AAAA,SAChBT,OAAO,IAAIU,SAAS;AAAA,SACpBV,OAAO,IAAIW,WAAW;AAAA,SACtBX,OAAO,IAAIY,IAAI;AAAA,SACfZ,OAAO,IAAIa,iBAAiB;AAAA,SAC5Bb,OAAO,IAAIc,WAAW;AAAA,SACtBd,OAAO,IAAIe,aAAa;AAAA,SACxBf,OAAO,IAAIgB,kBAAkB;AAAA,SAC7BhB,OAAO,IAAIiB,aAAa;AAAA,SACxBjB,OAAO,IAAIkB,oBAAoB;AAAA,SAC/BlB,OAAO,IAAImB,YAAY;AAAA,SACvBnB,OAAO,IAAIoB,YAAY;AAAA,SACvBpB,OAAO,IAAIqB,OAAO;AAAA,SAElBrB,OAAO,IAAIsB,eAAe;AAAA;AAAA,SAE1BtB,OAAO,IAAIuB,cAAc;AAAA,SACzBvB,OAAO,IAAIwB,wBAAwB;AAAA,SACnCxB,OAAO,IAAIyB,8BAA8B;AAAA"}
|
|
1
|
+
{"version":3,"file":"index-browser.mjs","names":["_getPollInterval","InvalidTxError","getHeight","poll","awaitHeight","waitForTxConfirm","sendTransaction","getAccount","getBalance","getCurrentGeneration","getGeneration","getMicroBlockTransactions","getKeyBlock","getMicroBlockHeader","txDryRun","getContractByteCode","getContract","getName","resolveName","getAddressFromPriv","isAddressValid","genSalt","encodeUnsigned","hash","encodeContractAddress","generateKeyPairFromSecret","generateKeyPair","sign","verify","messageToHash","signMessage","verifyMessage","isValidKeypair","recover","dump","toBytes","buildTx","buildTxAsync","buildTxHash","unpackTx","buildContractIdByContractTx","buildContractId","oracleQueryId","produceNameId","commitmentHash","readInt","isNameValid","ensureName","getDefaultPointerKey","getMinimumNameFee","computeBidFee","computeAuctionEndBlock","isAuctionName","MAX_AUTH_FUN_GAS","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_RANGES","ConsensusProtocolVersion","VmVersion","AbiVersion","Tag","ORACLE_TTL_TYPES","ORACLE_TTL","QUERY_TTL","RESPONSE_TTL","DRY_RUN_ACCOUNT","CallReturnType","getExecutionCost","getExecutionCostBySignedTx","getExecutionCostUsingNode","default","getTransactionSignerAddress","AE_AMOUNT_FORMATS","formatAmount","toAe","toAettos","prefixedAmount","DerivationError","deriveChild","derivePathFromKey","getMasterKeyFromSeed","derivePathFromSeed","getKeyPair","generateSaveHDWalletFromSeed","getSaveHDWalletAccounts","getHdWalletAccountFromSeed","encode","decode","Encoding","Encoded","encodeFateValue","decodeFateValue","hashTypedData","hashDomain","hashJson","aensRevoke","aensUpdate","aensTransfer","aensQuery","aensClaim","aensPreclaim","aensBid","Contract","pollForQueries","pollForQueryResponse","getQueryObject","postQueryToOracle","extendOracleTtl","respondToQuery","getOracleObject","registerOracle","spend","transferFunds","payForTransaction","createGeneralizedAccount","buildAuthTxHash","buildAuthTxHashByGaMetaTx","AeSdkMethods","AeSdkBase","AeSdk","AeSdkAepp","AeSdkWallet","Node","verifyTransaction","AccountBase","MemoryAccount","AccountGeneralized","AccountLedger","AccountLedgerFactory","CompilerBase","CompilerHttp","Channel","_MiddlewareSubscriber","MiddlewareSubscriberError","_MiddlewareSubscriberError","MiddlewareSubscriberDisconnected","_MiddlewareSubscriberDisconnected","_Middleware","connectionProxy","MESSAGE_DIRECTION","WALLET_TYPE","SUBSCRIPTION_TYPES","METHODS","RPC_STATUS","RpcError","RpcInvalidTransactionError","RpcRejectedByUserError","RpcUnsupportedProtocolError","RpcConnectionDenyError","RpcNotAuthorizeError","RpcPermissionDenyError","RpcInternalError","RpcMethodNotFoundError","walletDetector","BrowserRuntimeConnection","BrowserWindowMessageConnection","BaseError","AccountError","AensError","AeppError","ChannelError","CompilerError","ContractError","CryptographyError","NodeError","TransactionError","WalletError","ArgumentError","IllegalArgumentError","ArgumentCountMismatchError","InsufficientBalanceError","MissingParamError","NoSerializerFoundError","RequestTimedOutError","TxTimedOutError","TypeError","UnsupportedPlatformError","UnsupportedProtocolError","NotImplementedError","UnsupportedVersionError","InternalError","UnexpectedTsError","UnavailableAccountError","AensPointerContextError","InsufficientNameFeeError","InvalidAensNameError","InvalidRpcMessageError","MissingCallbackError","UnAuthorizedAccountError","UnknownRpcClientError","UnsubscribedAccountError","ChannelCallError","ChannelConnectionError","ChannelPingTimedOutError","UnexpectedChannelMessageError","ChannelIncomingMessageError","UnknownChannelStateError","InvalidAuthDataError","BytecodeMismatchError","DuplicateContractError","InactiveContractError","InvalidMethodInvocationError","MissingContractAddressError","MissingContractDefError","MissingFunctionNameError","NodeInvocationError","NoSuchContractFunctionError","NotPayableFunctionError","MissingEventDefinitionError","AmbiguousEventDefinitionError","InvalidChecksumError","InvalidPasswordError","MerkleTreeHashMismatchError","MissingNodeInTreeError","UnknownNodeLengthError","UnknownPathNibbleError","DuplicateNodeError","NodeNotFoundError","DecodeError","PayloadLengthError","DryRunError","IllegalBidFeeError","InvalidSignatureError","PrefixNotFoundError","SchemaNotFoundError","TagNotFoundError","TxNotInChainError","AlreadyConnectedError","NoWalletConnectedError","RpcConnectionError","RpcBroadcastError","NAME_BID_MAX_LENGTH"],"sources":["../src/index-browser.ts"],"sourcesContent":["export {\n _getPollInterval, InvalidTxError, getHeight, poll, awaitHeight, waitForTxConfirm, sendTransaction,\n getAccount, getBalance, getCurrentGeneration, getGeneration, getMicroBlockTransactions,\n getKeyBlock, getMicroBlockHeader, txDryRun, getContractByteCode, getContract, getName,\n resolveName,\n} from './chain';\nexport {\n getAddressFromPriv, isAddressValid, genSalt, encodeUnsigned, hash, encodeContractAddress,\n generateKeyPairFromSecret, generateKeyPair, sign, verify, messageToHash, signMessage,\n verifyMessage, isValidKeypair,\n} from './utils/crypto';\nexport { recover, dump } from './utils/keystore';\nexport type { Keystore } from './utils/keystore';\nexport { toBytes } from './utils/bytes';\nexport {\n buildTx, buildTxAsync, buildTxHash, unpackTx, buildContractIdByContractTx,\n} from './tx/builder';\nexport {\n buildContractId, oracleQueryId, produceNameId, commitmentHash, readInt, isNameValid, ensureName,\n getDefaultPointerKey, getMinimumNameFee, computeBidFee, computeAuctionEndBlock, isAuctionName,\n} from './tx/builder/helpers';\nexport {\n MAX_AUTH_FUN_GAS, NAME_TTL, NAME_MAX_TTL, NAME_MAX_CLIENT_TTL, CLIENT_TTL, MIN_GAS_PRICE,\n NAME_FEE_MULTIPLIER, NAME_FEE_BID_INCREMENT, NAME_BID_TIMEOUT_BLOCKS, NAME_MAX_LENGTH_FEE,\n NAME_BID_RANGES, ConsensusProtocolVersion, VmVersion, AbiVersion, Tag,\n} from './tx/builder/constants';\nexport type { Int, AensName } from './tx/builder/constants';\n// TODO: move to constants\nexport {\n ORACLE_TTL_TYPES, ORACLE_TTL, QUERY_TTL, RESPONSE_TTL, DRY_RUN_ACCOUNT, CallReturnType,\n} from './tx/builder/schema';\nexport {\n getExecutionCost, getExecutionCostBySignedTx, getExecutionCostUsingNode,\n} from './tx/execution-cost';\nexport { default as getTransactionSignerAddress } from './tx/transaction-signer';\nexport {\n AE_AMOUNT_FORMATS, formatAmount, toAe, toAettos, prefixedAmount,\n} from './utils/amount-formatter';\nexport {\n DerivationError, deriveChild, derivePathFromKey, getMasterKeyFromSeed, derivePathFromSeed,\n getKeyPair, generateSaveHDWalletFromSeed, getSaveHDWalletAccounts, getHdWalletAccountFromSeed,\n} from './utils/hd-wallet';\nexport {\n encode, decode, Encoding, Encoded,\n} from './utils/encoder';\nexport {\n encodeFateValue, decodeFateValue, hashTypedData, hashDomain, hashJson,\n} from './utils/typed-data';\nexport {\n aensRevoke, aensUpdate, aensTransfer, aensQuery, aensClaim, aensPreclaim, aensBid,\n} from './aens';\nexport { default as Contract } from './contract/Contract';\nexport type { ContractMethodsBase } from './contract/Contract';\nexport {\n pollForQueries, pollForQueryResponse, getQueryObject, postQueryToOracle, extendOracleTtl,\n respondToQuery, getOracleObject, registerOracle,\n} from './oracle';\nexport { spend, transferFunds, payForTransaction } from './spend';\nexport { createGeneralizedAccount, buildAuthTxHash, buildAuthTxHashByGaMetaTx } from './contract/ga';\n\nexport { default as AeSdkMethods } from './AeSdkMethods';\nexport { default as AeSdkBase } from './AeSdkBase';\nexport { default as AeSdk } from './AeSdk';\nexport { default as AeSdkAepp } from './AeSdkAepp';\nexport { default as AeSdkWallet } from './AeSdkWallet';\nexport { default as Node } from './Node';\nexport { default as verifyTransaction } from './tx/validator';\nexport { default as AccountBase } from './account/Base';\nexport { default as MemoryAccount } from './account/Memory';\nexport { default as AccountGeneralized } from './account/Generalized';\nexport { default as AccountLedger } from './account/Ledger';\nexport { default as AccountLedgerFactory } from './account/LedgerFactory';\nexport { default as CompilerBase } from './contract/compiler/Base';\nexport { default as CompilerHttp } from './contract/compiler/Http';\nexport { default as Channel } from './channel/Contract';\nexport {\n default as _MiddlewareSubscriber,\n MiddlewareSubscriberError as _MiddlewareSubscriberError,\n MiddlewareSubscriberDisconnected as _MiddlewareSubscriberDisconnected,\n} from './MiddlewareSubscriber';\nexport { default as _Middleware } from './Middleware';\n\nexport { default as connectionProxy } from './aepp-wallet-communication/connection-proxy';\nexport {\n MESSAGE_DIRECTION, WALLET_TYPE, SUBSCRIPTION_TYPES, METHODS, RPC_STATUS, RpcError,\n RpcInvalidTransactionError, RpcRejectedByUserError, RpcUnsupportedProtocolError,\n RpcConnectionDenyError, RpcNotAuthorizeError, RpcPermissionDenyError, RpcInternalError,\n RpcMethodNotFoundError,\n} from './aepp-wallet-communication/schema';\nexport { default as walletDetector } from './aepp-wallet-communication/wallet-detector';\nexport { default as BrowserRuntimeConnection } from './aepp-wallet-communication/connection/BrowserRuntime';\nexport { default as BrowserWindowMessageConnection } from './aepp-wallet-communication/connection/BrowserWindowMessage';\nexport {\n BaseError, AccountError, AensError, AeppError, ChannelError, CompilerError, ContractError,\n CryptographyError, NodeError, TransactionError, WalletError, ArgumentError, IllegalArgumentError,\n ArgumentCountMismatchError, InsufficientBalanceError, MissingParamError, NoSerializerFoundError,\n RequestTimedOutError, TxTimedOutError, TypeError, UnsupportedPlatformError,\n UnsupportedProtocolError, NotImplementedError, UnsupportedVersionError, InternalError,\n UnexpectedTsError, UnavailableAccountError, AensPointerContextError, InsufficientNameFeeError,\n InvalidAensNameError, InvalidRpcMessageError, MissingCallbackError, UnAuthorizedAccountError,\n UnknownRpcClientError, UnsubscribedAccountError, ChannelCallError, ChannelConnectionError,\n ChannelPingTimedOutError, UnexpectedChannelMessageError, ChannelIncomingMessageError,\n UnknownChannelStateError, InvalidAuthDataError, BytecodeMismatchError, DuplicateContractError,\n InactiveContractError, InvalidMethodInvocationError, MissingContractAddressError,\n MissingContractDefError, MissingFunctionNameError, NodeInvocationError,\n NoSuchContractFunctionError, NotPayableFunctionError, MissingEventDefinitionError,\n AmbiguousEventDefinitionError, InvalidChecksumError, InvalidPasswordError,\n MerkleTreeHashMismatchError, MissingNodeInTreeError, UnknownNodeLengthError,\n UnknownPathNibbleError, DuplicateNodeError, NodeNotFoundError, DecodeError, PayloadLengthError,\n DryRunError, IllegalBidFeeError, InvalidSignatureError, PrefixNotFoundError, SchemaNotFoundError,\n TagNotFoundError, TxNotInChainError, AlreadyConnectedError, NoWalletConnectedError,\n RpcConnectionError,\n} from './utils/errors';\nexport { RpcBroadcastError, NAME_BID_MAX_LENGTH } from './deprecated';\n"],"mappings":"SACEA,gBAAgB,EAAEC,cAAc,EAAEC,SAAS,EAAEC,IAAI,EAAEC,WAAW,EAAEC,gBAAgB,EAAEC,eAAe,EACjGC,UAAU,EAAEC,UAAU,EAAEC,oBAAoB,EAAEC,aAAa,EAAEC,yBAAyB,EACtFC,WAAW,EAAEC,mBAAmB,EAAEC,QAAQ,EAAEC,mBAAmB,EAAEC,WAAW,EAAEC,OAAO,EACrFC,WAAW;AAAA,SAGXC,kBAAkB,EAAEC,cAAc,EAAEC,OAAO,EAAEC,cAAc,EAAEC,IAAI,EAAEC,qBAAqB,EACxFC,yBAAyB,EAAEC,eAAe,EAAEC,IAAI,EAAEC,MAAM,EAAEC,aAAa,EAAEC,WAAW,EACpFC,aAAa,EAAEC,cAAc;AAAA,SAEtBC,OAAO,EAAEC,IAAI;AAAA,SAEbC,OAAO;AAAA,SAEdC,OAAO,EAAEC,YAAY,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,2BAA2B;AAAA,SAGzEC,eAAe,EAAEC,aA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AAEC,oBAAoB,EAChGC,0BAA0B,EAAEC,wBAAwB,EAAEC,iBAAiB,EAAEC,sBAAsB,EAC/FC,oBAAoB,EAAEC,eAAe,EAAEC,SAAS,EAAEC,wBAAwB,EAC1EC,wBAAwB,EAAEC,mBAAmB,EAAEC,uBAAuB,EAAEC,aAAa,EACrFC,iBAAiB,EAAEC,uBAAuB,EAAEC,uBAAuB,EAAEC,wBAAwB,EAC7FC,oBAAoB,EAAEC,sBAAsB,EAAEC,oBAAoB,EAAEC,wBAAwB,EAC5FC,qBAAqB,EAAEC,wBAAwB,EAAEC,gBAAgB,EAAEC,sBAAsB,EACzFC,wBAAwB,EAAEC,6BAA6B,EAAEC,2BAA2B,EACpFC,wBAAwB,EAAEC,oBAAoB,EAAEC,qBAAqB,EAAEC,sBAAsB,EAC7FC,qBAAqB,EAAEC,4BAA4B,EAAEC,2BAA2B,EAChFC,uBAAuB,EAAEC,wBAAwB,EAAEC,mBAAmB,EACtEC,2BAA2B,EAAEC,uBAAuB,EAAEC,2BAA2B,EACjFC,6BAA6B,EAAEC,oBAAoB,EAAEC,oBAAoB,EACzEC,2BAA2B,EAAEC,sBAAsB,EAAEC,sBAAsB,EAC3EC,sBAAsB,EAAEC,kBAAkB,EAAEC,iBAAiB,EAAEC,WAAW,EAAEC,kBAAkB,EAC9FC,WAAW,EAAEC,kBAAkB,EAAEC,qBAAqB,EAAEC,mBAAmB,EAAEC,mBAAmB,EAChGC,gBAAgB,EAAEC,iBAAiB,EAAEC,qBAAqB,EAAEC,sBAAsB,EAClFC,kBAAkB;AAAA,SAEXC,iBAAiB,EAAEC,mBAAmB"}
|
|
@@ -11,7 +11,6 @@ export declare const NAME_FEE_MULTIPLIER = 100000000000000;
|
|
|
11
11
|
export declare const NAME_FEE_BID_INCREMENT = 0.05;
|
|
12
12
|
export declare const NAME_BID_TIMEOUT_BLOCKS = 480;
|
|
13
13
|
export declare const NAME_MAX_LENGTH_FEE = 31;
|
|
14
|
-
export declare const NAME_BID_MAX_LENGTH = 12;
|
|
15
14
|
export declare const NAME_BID_RANGES: {
|
|
16
15
|
[k: string]: BigNumber;
|
|
17
16
|
};
|
|
@@ -16,7 +16,6 @@ export const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage
|
|
|
16
16
|
export const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day
|
|
17
17
|
// # this is the max length for a domain that requires a base fee to be paid
|
|
18
18
|
export const NAME_MAX_LENGTH_FEE = 31;
|
|
19
|
-
export const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid
|
|
20
19
|
// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290
|
|
21
20
|
// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times
|
|
22
21
|
// # bid ranges:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","MAX_AUTH_FUN_GAS","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","MAX_AUTH_FUN_GAS","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_RANGES","_ref","key","value","times","ConsensusProtocolVersion","VmVersion","AbiVersion","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\nexport const MAX_AUTH_FUN_GAS = 50000;\nexport type Int = number | string | BigNumber;\n// # AENS\nexport type AensName = `${string}.chain`;\nexport const NAME_TTL = 180000;\n// # max number of block into the future that the name is going to be available\n// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update\n// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry\nexport const NAME_MAX_TTL = 36000;\nexport const NAME_MAX_CLIENT_TTL = 84600;\nexport const CLIENT_TTL = NAME_MAX_CLIENT_TTL;\nexport const MIN_GAS_PRICE = 1e9;\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67\nexport const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000\nexport const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272\nexport const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day\n// # this is the max length for a domain that requires a base fee to be paid\nexport const NAME_MAX_LENGTH_FEE = 31;\n// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290\n// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times\n// # bid ranges:\nexport const NAME_BID_RANGES = mapObject({\n 31: 3,\n 30: 5,\n 29: 8,\n 28: 13,\n 27: 21,\n 26: 34,\n 25: 55,\n 24: 89,\n 23: 144,\n 22: 233,\n 21: 377,\n 20: 610,\n 19: 987,\n 18: 1597,\n 17: 2584,\n 16: 4181,\n 15: 6765,\n 14: 10946,\n 13: 17711,\n 12: 28657,\n 11: 46368,\n 10: 75025,\n 9: 121393,\n 8: 196418,\n 7: 317811,\n 6: 514229,\n 5: 832040,\n 4: 1346269,\n 3: 2178309,\n 2: 3524578,\n 1: 5702887,\n}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);\n\nexport enum ConsensusProtocolVersion {\n Iris = 5,\n Ceres = 6,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum VmVersion {\n NoVm = 0,\n Sophia = 1,\n SophiaImprovementsMinerva = 3,\n SophiaImprovementsFortuna = 4,\n Fate = 5,\n SophiaImprovementsLima = 6,\n Fate2 = 7,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum AbiVersion {\n NoAbi = 0,\n Sophia = 1,\n Fate = 3,\n}\n\n/**\n * Enum with tag types\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}\n */\n// TODO: implement serialisation for commented-out tags\nexport enum Tag {\n Account = 10,\n SignedTx = 11,\n SpendTx = 12,\n Oracle = 20,\n // OracleQuery = 21,\n OracleRegisterTx = 22,\n OracleQueryTx = 23,\n OracleResponseTx = 24,\n OracleExtendTx = 25,\n Name = 30,\n // NameCommitment = 31,\n NameClaimTx = 32,\n NamePreclaimTx = 33,\n NameUpdateTx = 34,\n NameRevokeTx = 35,\n NameTransferTx = 36,\n // NameAuction = 37,\n Contract = 40,\n ContractCall = 41,\n ContractCreateTx = 42,\n ContractCallTx = 43,\n ChannelCreateTx = 50,\n // ChannelSetDelegatesTx = 501,\n ChannelDepositTx = 51,\n ChannelWithdrawTx = 52,\n ChannelForceProgressTx = 521,\n ChannelCloseMutualTx = 53,\n ChannelCloseSoloTx = 54,\n ChannelSlashTx = 55,\n ChannelSettleTx = 56,\n ChannelOffChainTx = 57,\n ChannelOffChainUpdateTransfer = 570,\n ChannelOffChainUpdateDeposit = 571,\n ChannelOffChainUpdateWithdraw = 572,\n ChannelOffChainUpdateCreateContract = 573,\n ChannelOffChainUpdateCallContract = 574,\n // ChannelOffChainUpdateMeta = 576,\n ChannelClientReconnectTx = 575,\n Channel = 58,\n ChannelSnapshotSoloTx = 59,\n TreesPoi = 60,\n // TreesDb = 61,\n StateTrees = 62,\n Mtree = 63,\n MtreeValue = 64,\n ContractsMtree = 621,\n CallsMtree = 622,\n ChannelsMtree = 623,\n NameserviceMtree = 624,\n OraclesMtree = 625,\n AccountsMtree = 626,\n // CompilerSophia = 70,\n GaAttachTx = 80,\n GaMetaTx = 81,\n PayingForTx = 82,\n GaMetaTxAuthData = 810,\n // KeyBlock = 100,\n // MicroBlock = 101,\n // LightMicroBlock = 102,\n // Pof = 200,\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,SAAS;AAElB,OAAO,MAAMC,gBAAgB,GAAG,KAAK;AAIrC,OAAO,MAAMC,QAAQ,GAAG,MAAM;AAC9B;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG,KAAK;AACjC,OAAO,MAAMC,mBAAmB,GAAG,KAAK;AACxC,OAAO,MAAMC,UAAU,GAAGD,mBAAmB;AAC7C,OAAO,MAAME,aAAa,GAAG,GAAG;AAChC;AACA,OAAO,MAAMC,mBAAmB,GAAG,IAAI,CAAC,CAAC;AACzC,OAAO,MAAMC,sBAAsB,GAAG,IAAI,CAAC,CAAC;AAC5C;AACA,OAAO,MAAMC,uBAAuB,GAAG,GAAG,CAAC,CAAC;AAC5C;AACA,OAAO,MAAMC,mBAAmB,GAAG,EAAE;AACrC;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAGX,SAAS,CAAC;EACvC,EAAE,EAAE,CAAC;EACL,EAAE,EAAE,CAAC;EACL,EAAE,EAAE,CAAC;EACL,EAAE,EAAE,EAAE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;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;AAAA,GAAHA,GAAG,KAAHA,GAAG"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Int } from '../constants';
|
|
3
3
|
import { AE_AMOUNT_FORMATS } from '../../../utils/amount-formatter';
|
|
4
4
|
declare const _default: {
|
|
5
|
-
serializeAettos(value: string | undefined): string;
|
|
5
|
+
serializeAettos(value: string | undefined, params: {}): string;
|
|
6
6
|
serialize(value: Int | undefined, params: {}, { denomination }: {
|
|
7
7
|
denomination?: AE_AMOUNT_FORMATS | undefined;
|
|
8
8
|
}): Buffer;
|
|
@@ -2,7 +2,8 @@ import uInt from "./u-int.mjs";
|
|
|
2
2
|
import { AE_AMOUNT_FORMATS, formatAmount } from "../../../utils/amount-formatter.mjs";
|
|
3
3
|
export default {
|
|
4
4
|
...uInt,
|
|
5
|
-
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
+
serializeAettos(value, params) {
|
|
6
7
|
return value !== null && value !== void 0 ? value : '0';
|
|
7
8
|
},
|
|
8
9
|
serialize(value, params, _ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coin-amount.mjs","names":["uInt","AE_AMOUNT_FORMATS","formatAmount","serializeAettos","value","
|
|
1
|
+
{"version":3,"file":"coin-amount.mjs","names":["uInt","AE_AMOUNT_FORMATS","formatAmount","serializeAettos","value","params","serialize","_ref","denomination","AETTOS"],"sources":["../../../../src/tx/builder/field-types/coin-amount.ts"],"sourcesContent":["import uInt from './u-int';\nimport { Int } from '../constants';\nimport { AE_AMOUNT_FORMATS, formatAmount } from '../../../utils/amount-formatter';\n\nexport default {\n ...uInt,\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n serializeAettos(value: string | undefined, params: {}): string {\n return value ?? '0';\n },\n\n serialize(\n value: Int | undefined,\n params: {},\n { denomination = AE_AMOUNT_FORMATS.AETTOS }: { denomination?: AE_AMOUNT_FORMATS },\n ): Buffer {\n return uInt.serialize(\n this.serializeAettos(\n value != null ? formatAmount(value, { denomination }) : value,\n params,\n ),\n );\n },\n};\n"],"mappings":"OAAOA,IAAI;AAAA,SAEFC,iBAAiB,EAAEC,YAAY;AAExC,eAAe;EACb,GAAGF,IAAI;EAEP;EACAG,eAAeA,CAACC,KAAyB,EAAEC,MAAU,EAAU;IAC7D,OAAOD,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,GAAG;EACrB,CAAC;EAEDE,SAASA,CACPF,KAAsB,EACtBC,MAAU,EAAAE,IAAA,EAEF;IAAA,IADR;MAAEC,YAAY,GAAGP,iBAAiB,CAACQ;IAA6C,CAAC,GAAAF,IAAA;IAEjF,OAAOP,IAAI,CAACM,SAAS,CACnB,IAAI,CAACH,eAAe,CAClBC,KAAK,IAAI,IAAI,GAAGF,YAAY,CAACE,KAAK,EAAE;MAAEI;IAAa,CAAC,CAAC,GAAGJ,KAAK,EAC7DC,MAAM,CACP,CACF;EACH;AACF,CAAC"}
|
|
@@ -9,7 +9,7 @@ declare const _default: {
|
|
|
9
9
|
* @returns Deposit value Buffer.
|
|
10
10
|
*/
|
|
11
11
|
serialize(value: Int | undefined, options: Parameters<(typeof coinAmount)['serialize']>[1], parameters: Parameters<(typeof coinAmount)['serialize']>[2]): Buffer;
|
|
12
|
-
serializeAettos(value: string | undefined): string;
|
|
12
|
+
serializeAettos(value: string | undefined, params: {}): string;
|
|
13
13
|
deserialize(value: Buffer): string;
|
|
14
14
|
};
|
|
15
15
|
export default _default;
|
|
@@ -3,6 +3,7 @@ const {
|
|
|
3
3
|
Buffer: _Buffer
|
|
4
4
|
} = _buffer;
|
|
5
5
|
import { decode, encode, Encoding } from "../../../utils/encoder.mjs";
|
|
6
|
+
import { Tag } from "../constants.mjs";
|
|
6
7
|
import { ArgumentError } from "../../../utils/errors.mjs";
|
|
7
8
|
export default function genEntryField(tag) {
|
|
8
9
|
return {
|
|
@@ -26,7 +27,7 @@ export default function genEntryField(tag) {
|
|
|
26
27
|
unpackTx
|
|
27
28
|
} = _ref2;
|
|
28
29
|
const tx = unpackTx(encode(buf, Encoding.Transaction));
|
|
29
|
-
if (tag != null && tx.tag !== tag) throw new ArgumentError('Tag', tag, tx.tag);
|
|
30
|
+
if (tag != null && tx.tag !== tag) throw new ArgumentError('Tag', Tag[tag], Tag[tx.tag]);
|
|
30
31
|
return tx;
|
|
31
32
|
}
|
|
32
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.mjs","names":["decode","encode","Encoding","ArgumentError","genEntryField","tag","serialize","txParams","_ref","buildTx","ArrayBuffer","isView","_Buffer","from","startsWith","deserialize","buf","_ref2","unpackTx","tx","Transaction"],"sources":["../../../../src/tx/builder/field-types/entry.ts"],"sourcesContent":["import {\n decode, encode, Encoded, Encoding,\n} from '../../../utils/encoder';\nimport { Tag } from '../constants';\nimport { ArgumentError } from '../../../utils/errors';\nimport type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';\n\nexport default function genEntryField<T extends Tag = Tag>(tag?: T): {\n serialize: (\n // TODO: replace with `TxParams & { tag: T }`,\n // but fix TS2502 value is referenced directly or indirectly in its own type annotation\n value: any,\n options: { buildTx: typeof buildTxType },\n ) => Buffer;\n deserialize: (\n value: Buffer, options: { unpackTx: typeof unpackTxType },\n // TODO: replace with `TxUnpacked & { tag: T }`,\n // TS2577 Return type annotation circularly references itself\n ) => any;\n} {\n return {\n serialize(txParams, { buildTx }) {\n if (ArrayBuffer.isView(txParams)) return Buffer.from(txParams as any);\n if (typeof txParams === 'string' && txParams.startsWith('tx_')) {\n return decode(txParams as Encoded.Transaction);\n }\n return decode(buildTx({ ...txParams, ...tag != null && { tag } }));\n },\n\n deserialize(buf, { unpackTx }) {\n const tx = unpackTx(encode(buf, Encoding.Transaction));\n if (tag != null && tx.tag !== tag) throw new ArgumentError('Tag', tag, tx.tag);\n return tx;\n },\n };\n}\n"],"mappings":";;;;SACEA,MAAM,EAAEC,MAAM,EAAWC,QAAQ;AAAA,
|
|
1
|
+
{"version":3,"file":"entry.mjs","names":["decode","encode","Encoding","Tag","ArgumentError","genEntryField","tag","serialize","txParams","_ref","buildTx","ArrayBuffer","isView","_Buffer","from","startsWith","deserialize","buf","_ref2","unpackTx","tx","Transaction"],"sources":["../../../../src/tx/builder/field-types/entry.ts"],"sourcesContent":["import {\n decode, encode, Encoded, Encoding,\n} from '../../../utils/encoder';\nimport { Tag } from '../constants';\nimport { ArgumentError } from '../../../utils/errors';\nimport type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';\n\nexport default function genEntryField<T extends Tag = Tag>(tag?: T): {\n serialize: (\n // TODO: replace with `TxParams & { tag: T }`,\n // but fix TS2502 value is referenced directly or indirectly in its own type annotation\n value: any,\n options: { buildTx: typeof buildTxType },\n ) => Buffer;\n deserialize: (\n value: Buffer, options: { unpackTx: typeof unpackTxType },\n // TODO: replace with `TxUnpacked & { tag: T }`,\n // TS2577 Return type annotation circularly references itself\n ) => any;\n} {\n return {\n serialize(txParams, { buildTx }) {\n if (ArrayBuffer.isView(txParams)) return Buffer.from(txParams as any);\n if (typeof txParams === 'string' && txParams.startsWith('tx_')) {\n return decode(txParams as Encoded.Transaction);\n }\n return decode(buildTx({ ...txParams, ...tag != null && { tag } }));\n },\n\n deserialize(buf, { unpackTx }) {\n const tx = unpackTx(encode(buf, Encoding.Transaction));\n if (tag != null && tx.tag !== tag) throw new ArgumentError('Tag', Tag[tag], Tag[tx.tag]);\n return tx;\n },\n };\n}\n"],"mappings":";;;;SACEA,MAAM,EAAEC,MAAM,EAAWC,QAAQ;AAAA,SAE1BC,GAAG;AAAA,SACHC,aAAa;AAGtB,eAAe,SAASC,aAAaA,CAAsBC,GAAO,EAYhE;EACA,OAAO;IACLC,SAASA,CAACC,QAAQ,EAAAC,IAAA,EAAe;MAAA,IAAb;QAAEC;MAAQ,CAAC,GAAAD,IAAA;MAC7B,IAAIE,WAAW,CAACC,MAAM,CAACJ,QAAQ,CAAC,EAAE,OAAOK,OAAA,CAAOC,IAAI,CAACN,QAAQ,CAAQ;MACrE,IAAI,OAAOA,QAAQ,KAAK,QAAQ,IAAIA,QAAQ,CAACO,UAAU,CAAC,KAAK,CAAC,EAAE;QAC9D,OAAOf,MAAM,CAACQ,QAAQ,CAAwB;MAChD;MACA,OAAOR,MAAM,CAACU,OAAO,CAAC;QAAE,GAAGF,QAAQ;QAAE,IAAGF,GAAG,IAAI,IAAI,IAAI;UAAEA;QAAI,CAAC;MAAC,CAAC,CAAC,CAAC;IACpE,CAAC;IAEDU,WAAWA,CAACC,GAAG,EAAAC,KAAA,EAAgB;MAAA,IAAd;QAAEC;MAAS,CAAC,GAAAD,KAAA;MAC3B,MAAME,EAAE,GAAGD,QAAQ,CAAClB,MAAM,CAACgB,GAAG,EAAEf,QAAQ,CAACmB,WAAW,CAAC,CAAC;MACtD,IAAIf,GAAG,IAAI,IAAI,IAAIc,EAAE,CAACd,GAAG,KAAKA,GAAG,EAAE,MAAM,IAAIF,aAAa,CAAC,KAAK,EAAED,GAAG,CAACG,GAAG,CAAC,EAAEH,GAAG,CAACiB,EAAE,CAACd,GAAG,CAAC,CAAC;MACxF,OAAOc,EAAE;IACX;EACF,CAAC;AACH"}
|
|
@@ -31,7 +31,7 @@ declare const boolean: {
|
|
|
31
31
|
deserialize(buffer: Buffer): boolean;
|
|
32
32
|
};
|
|
33
33
|
declare const coinAmount: {
|
|
34
|
-
serializeAettos(value: string | undefined): string;
|
|
34
|
+
serializeAettos(value: string | undefined, params: {}): string;
|
|
35
35
|
serialize(value: import("../constants").Int | undefined, params: {}, { denomination }: {
|
|
36
36
|
denomination?: import("../../..").AE_AMOUNT_FORMATS | undefined;
|
|
37
37
|
}): Buffer;
|
|
@@ -51,7 +51,7 @@ declare const deposit: {
|
|
|
51
51
|
serialize(value: import("../constants").Int | undefined, options: {}, parameters: {
|
|
52
52
|
denomination?: import("../../..").AE_AMOUNT_FORMATS | undefined;
|
|
53
53
|
}): Buffer;
|
|
54
|
-
serializeAettos(value: string | undefined): string;
|
|
54
|
+
serializeAettos(value: string | undefined, params: {}): string;
|
|
55
55
|
deserialize(value: Buffer): string;
|
|
56
56
|
};
|
|
57
57
|
declare const encoded: typeof _encoded;
|