@aeternity/aepp-sdk 13.0.0-alpha.0 → 13.0.0-alpha.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.
- 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 +4206 -1127
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdkBase.d.ts +3 -3
- package/es/AeSdkBase.mjs +4 -0
- package/es/AeSdkBase.mjs.map +1 -1
- package/es/AeSdkMethods.d.ts +3 -4
- package/es/AeSdkMethods.mjs.map +1 -1
- package/es/Node.d.ts +4 -3
- package/es/Node.mjs +1 -1
- package/es/Node.mjs.map +1 -1
- package/es/account/Base.d.ts +2 -2
- package/es/account/Base.mjs.map +1 -1
- package/es/account/Generalized.mjs +5 -3
- package/es/account/Generalized.mjs.map +1 -1
- package/es/account/Ledger.mjs +2 -1
- package/es/account/Ledger.mjs.map +1 -1
- package/es/account/Memory.mjs +2 -1
- package/es/account/Memory.mjs.map +1 -1
- package/es/aens.d.ts +1 -1
- package/es/aens.mjs +5 -1
- package/es/aens.mjs.map +1 -1
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +19 -4
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +1 -1
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
- package/es/chain.d.ts +9 -1
- package/es/chain.mjs +4 -1
- package/es/chain.mjs.map +1 -1
- package/es/channel/Base.d.ts +6 -1
- package/es/channel/Base.mjs +9 -6
- package/es/channel/Base.mjs.map +1 -1
- package/es/channel/Contract.d.ts +8 -7
- package/es/channel/Contract.mjs +1 -1
- package/es/channel/Contract.mjs.map +1 -1
- package/es/channel/Spend.d.ts +3 -1
- package/es/channel/Spend.mjs +4 -2
- package/es/channel/Spend.mjs.map +1 -1
- package/es/channel/handlers.mjs +11 -9
- package/es/channel/handlers.mjs.map +1 -1
- package/es/channel/internal.mjs +3 -1
- package/es/channel/internal.mjs.map +1 -1
- package/es/contract/Contract.d.ts +21 -46
- package/es/contract/Contract.mjs +69 -52
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +81 -0
- package/es/contract/compiler/Base.mjs +5 -0
- package/es/contract/compiler/Base.mjs.map +1 -0
- package/es/contract/compiler/Cli.d.ts +23 -0
- package/es/contract/compiler/Cli.mjs +155 -0
- package/es/contract/compiler/Cli.mjs.map +1 -0
- package/es/contract/compiler/Http.d.ts +32 -0
- package/es/contract/{CompilerHttp.mjs → compiler/Http.mjs} +64 -9
- package/es/contract/compiler/Http.mjs.map +1 -0
- package/es/contract/compiler/HttpNode.d.ts +17 -0
- package/es/contract/compiler/HttpNode.mjs +26 -0
- package/es/contract/compiler/HttpNode.mjs.map +1 -0
- package/es/contract/compiler/getFileSystem.d.ts +6 -0
- package/es/contract/compiler/getFileSystem.mjs +40 -0
- package/es/contract/compiler/getFileSystem.mjs.map +1 -0
- package/es/contract/ga.d.ts +5 -4
- package/es/contract/ga.mjs +11 -2
- package/es/contract/ga.mjs.map +1 -1
- package/es/index-browser.d.ts +39 -0
- package/es/index-browser.mjs +55 -0
- package/es/index-browser.mjs.map +1 -0
- package/es/index.d.ts +4 -38
- package/es/index.mjs +4 -53
- package/es/index.mjs.map +1 -1
- package/es/oracle.mjs +1 -1
- package/es/oracle.mjs.map +1 -1
- package/es/spend.mjs +1 -3
- package/es/spend.mjs.map +1 -1
- package/es/tx/builder/constants.d.ts +28 -1
- package/es/tx/builder/constants.mjs +32 -3
- package/es/tx/builder/constants.mjs.map +1 -1
- package/es/tx/builder/field-types/abi-version.d.ts +10 -0
- package/es/tx/builder/field-types/abi-version.mjs +20 -0
- package/es/tx/builder/field-types/abi-version.mjs.map +1 -0
- package/es/tx/builder/field-types/address.d.ts +5 -6
- package/es/tx/builder/field-types/address.mjs +17 -8
- package/es/tx/builder/field-types/address.mjs.map +1 -1
- package/es/tx/builder/field-types/array.d.ts +7 -0
- package/es/tx/builder/field-types/array.mjs +11 -0
- package/es/tx/builder/field-types/array.mjs.map +1 -0
- package/es/tx/builder/field-types/boolean.d.ts +6 -0
- package/es/tx/builder/field-types/boolean.mjs +13 -0
- package/es/tx/builder/field-types/boolean.mjs.map +1 -0
- package/es/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
- package/es/tx/builder/field-types/ct-version.d.ts +30 -0
- package/es/tx/builder/field-types/ct-version.mjs +48 -0
- package/es/tx/builder/field-types/ct-version.mjs.map +1 -0
- package/es/tx/builder/field-types/deposit.d.ts +1 -1
- package/es/tx/builder/field-types/deposit.mjs.map +1 -1
- package/es/tx/builder/field-types/encoded.d.ts +6 -0
- package/es/tx/builder/field-types/encoded.mjs +21 -0
- package/es/tx/builder/field-types/encoded.mjs.map +1 -0
- package/es/tx/builder/field-types/entry.d.ts +11 -0
- package/es/tx/builder/field-types/entry.mjs +31 -0
- package/es/tx/builder/field-types/entry.mjs.map +1 -0
- package/es/tx/builder/field-types/enumeration.d.ts +5 -3
- package/es/tx/builder/field-types/enumeration.mjs +11 -2
- package/es/tx/builder/field-types/enumeration.mjs.map +1 -1
- package/es/tx/builder/field-types/fee.d.ts +10 -7
- package/es/tx/builder/field-types/fee.mjs +24 -20
- package/es/tx/builder/field-types/fee.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-limit.d.ts +5 -2
- package/es/tx/builder/field-types/gas-limit.mjs +9 -6
- package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.d.ts +1 -1
- package/es/tx/builder/field-types/index.d.ts +66 -28
- package/es/tx/builder/field-types/index.mjs +30 -12
- package/es/tx/builder/field-types/index.mjs.map +1 -1
- package/es/tx/builder/field-types/mptree.d.ts +37 -0
- package/es/tx/builder/field-types/mptree.mjs +268 -0
- package/es/tx/builder/field-types/mptree.mjs.map +1 -0
- package/es/tx/builder/field-types/name-fee.d.ts +1 -2
- package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
- package/es/tx/builder/field-types/name-id.mjs +2 -1
- package/es/tx/builder/field-types/name-id.mjs.map +1 -1
- package/es/tx/builder/field-types/pointers.mjs +2 -2
- package/es/tx/builder/field-types/pointers.mjs.map +1 -1
- package/es/tx/builder/field-types/raw.d.ts +6 -0
- package/es/tx/builder/field-types/raw.mjs +13 -0
- package/es/tx/builder/field-types/raw.mjs.map +1 -0
- package/es/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/es/tx/builder/field-types/short-u-int-const.mjs +16 -0
- package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -0
- package/es/tx/builder/field-types/string.d.ts +6 -0
- package/es/tx/builder/field-types/string.mjs +10 -0
- package/es/tx/builder/field-types/string.mjs.map +1 -0
- package/es/tx/builder/field-types/u-int.d.ts +1 -2
- package/es/tx/builder/field-types/u-int.mjs.map +1 -1
- package/es/tx/builder/index.d.ts +11 -29
- package/es/tx/builder/index.mjs +50 -211
- package/es/tx/builder/index.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +2111 -571
- package/es/tx/builder/schema.mjs +57 -125
- package/es/tx/builder/schema.mjs.map +1 -1
- package/es/tx/index.d.ts +5 -20
- package/es/tx/index.mjs +31 -88
- package/es/tx/index.mjs.map +1 -1
- package/es/tx/validator.d.ts +3 -5
- package/es/tx/validator.mjs +82 -95
- package/es/tx/validator.mjs.map +1 -1
- package/es/utils/bytes.mjs +1 -1
- package/es/utils/bytes.mjs.map +1 -1
- package/es/utils/errors.d.ts +3 -8
- package/es/utils/errors.mjs +1 -11
- package/es/utils/errors.mjs.map +1 -1
- package/es/utils/other.d.ts +1 -1
- package/package.json +35 -27
- package/src/AeSdkBase.ts +6 -3
- package/src/AeSdkMethods.ts +3 -4
- package/src/Node.ts +6 -3
- package/src/account/Base.ts +2 -2
- package/src/account/Generalized.ts +2 -2
- package/src/account/Ledger.ts +1 -1
- package/src/account/Memory.ts +1 -1
- package/src/aens.ts +3 -2
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +18 -7
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +2 -2
- package/src/chain.ts +5 -3
- package/src/channel/Base.ts +13 -5
- package/src/channel/Contract.ts +11 -10
- package/src/channel/Spend.ts +7 -2
- package/src/channel/handlers.ts +10 -9
- package/src/channel/internal.ts +1 -1
- package/src/contract/Contract.ts +69 -79
- package/src/contract/compiler/Base.ts +94 -0
- package/src/contract/compiler/Cli.ts +134 -0
- package/src/contract/compiler/Http.ts +124 -0
- package/src/contract/compiler/HttpNode.ts +26 -0
- package/src/contract/compiler/getFileSystem.ts +42 -0
- package/src/contract/ga.ts +9 -6
- package/src/index-browser.ts +58 -0
- package/src/index.ts +4 -56
- package/src/oracle.ts +1 -1
- package/src/spend.ts +1 -1
- package/src/tx/builder/constants.ts +32 -3
- package/src/tx/builder/field-types/abi-version.ts +21 -0
- package/src/tx/builder/field-types/address.ts +23 -13
- package/src/tx/builder/field-types/array.ts +19 -0
- package/src/tx/builder/field-types/boolean.ts +9 -0
- package/src/tx/builder/field-types/coin-amount.ts +2 -1
- package/src/tx/builder/field-types/ct-version.ts +50 -0
- package/src/tx/builder/field-types/deposit.ts +1 -1
- package/src/tx/builder/field-types/encoded.ts +27 -0
- package/src/tx/builder/field-types/entry.ts +31 -0
- package/src/tx/builder/field-types/enumeration.ts +15 -4
- package/src/tx/builder/field-types/fee.ts +38 -18
- package/src/tx/builder/field-types/gas-limit.ts +12 -7
- package/src/tx/builder/field-types/index.ts +46 -17
- package/src/tx/builder/field-types/mptree.ts +242 -0
- package/src/tx/builder/field-types/name-fee.ts +1 -2
- package/src/tx/builder/field-types/name-id.ts +1 -1
- package/src/tx/builder/field-types/pointers.ts +2 -2
- package/src/tx/builder/field-types/raw.ts +9 -0
- package/src/tx/builder/field-types/short-u-int-const.ts +20 -0
- package/src/tx/builder/field-types/string.ts +11 -0
- package/src/tx/builder/field-types/u-int.ts +1 -3
- package/src/tx/builder/index.ts +63 -247
- package/src/tx/builder/schema.ts +273 -323
- package/src/tx/index.ts +37 -104
- package/src/tx/validator.ts +72 -95
- package/src/utils/bytes.ts +1 -1
- package/src/utils/errors.ts +4 -13
- package/types-legacy/ts4.2/AeSdkBase.d.ts +3 -3
- package/types-legacy/ts4.2/AeSdkMethods.d.ts +3 -4
- package/types-legacy/ts4.2/Node.d.ts +3 -3
- package/types-legacy/ts4.2/account/Base.d.ts +2 -2
- package/types-legacy/ts4.2/aens.d.ts +1 -1
- package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/types-legacy/ts4.2/chain.d.ts +9 -1
- package/types-legacy/ts4.2/channel/Base.d.ts +6 -1
- package/types-legacy/ts4.2/channel/Contract.d.ts +8 -7
- package/types-legacy/ts4.2/channel/Spend.d.ts +3 -1
- package/types-legacy/ts4.2/contract/Contract.d.ts +21 -46
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +81 -0
- package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +23 -0
- package/types-legacy/ts4.2/contract/compiler/Http.d.ts +32 -0
- package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +17 -0
- package/types-legacy/ts4.2/contract/compiler/getFileSystem.d.ts +6 -0
- package/types-legacy/ts4.2/contract/ga.d.ts +5 -4
- package/types-legacy/ts4.2/index-browser.d.ts +39 -0
- package/types-legacy/ts4.2/index.d.ts +4 -38
- package/types-legacy/ts4.2/tx/builder/constants.d.ts +28 -1
- package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +10 -0
- package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +11 -12
- package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +7 -0
- package/types-legacy/ts4.2/tx/builder/field-types/boolean.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +42 -0
- package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/entry.d.ts +11 -0
- package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +5 -3
- package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +10 -7
- package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +5 -2
- package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +1 -1
- package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +72 -28
- package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +43 -0
- package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -2
- package/types-legacy/ts4.2/tx/builder/field-types/raw.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/types-legacy/ts4.2/tx/builder/field-types/string.d.ts +6 -0
- package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +1 -2
- package/types-legacy/ts4.2/tx/builder/index.d.ts +11 -29
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +2380 -668
- package/types-legacy/ts4.2/tx/index.d.ts +5 -20
- package/types-legacy/ts4.2/tx/validator.d.ts +3 -5
- package/types-legacy/ts4.2/utils/errors.d.ts +3 -8
- package/types-legacy/ts4.2/utils/other.d.ts +1 -1
- package/types-legacy/ts4.5/AeSdkBase.d.ts +3 -3
- package/types-legacy/ts4.5/AeSdkMethods.d.ts +3 -4
- package/types-legacy/ts4.5/Node.d.ts +3 -3
- package/types-legacy/ts4.5/account/Base.d.ts +2 -2
- package/types-legacy/ts4.5/aens.d.ts +1 -1
- package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
- package/types-legacy/ts4.5/chain.d.ts +9 -1
- package/types-legacy/ts4.5/channel/Base.d.ts +6 -1
- package/types-legacy/ts4.5/channel/Contract.d.ts +8 -7
- package/types-legacy/ts4.5/channel/Spend.d.ts +3 -1
- package/types-legacy/ts4.5/contract/Contract.d.ts +21 -46
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +81 -0
- package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +23 -0
- package/types-legacy/ts4.5/contract/compiler/Http.d.ts +32 -0
- package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +17 -0
- package/types-legacy/ts4.5/contract/compiler/getFileSystem.d.ts +6 -0
- package/types-legacy/ts4.5/contract/ga.d.ts +5 -4
- package/types-legacy/ts4.5/index-browser.d.ts +39 -0
- package/types-legacy/ts4.5/index.d.ts +4 -38
- package/types-legacy/ts4.5/tx/builder/constants.d.ts +28 -1
- package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +10 -0
- package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +11 -12
- package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +7 -0
- package/types-legacy/ts4.5/tx/builder/field-types/boolean.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +42 -0
- package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/entry.d.ts +11 -0
- package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +5 -3
- package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +10 -7
- package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +5 -2
- package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +1 -1
- package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +72 -28
- package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +43 -0
- package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -2
- package/types-legacy/ts4.5/tx/builder/field-types/raw.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +5 -0
- package/types-legacy/ts4.5/tx/builder/field-types/string.d.ts +6 -0
- package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +1 -2
- package/types-legacy/ts4.5/tx/builder/index.d.ts +11 -29
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +2380 -668
- package/types-legacy/ts4.5/tx/index.d.ts +5 -20
- package/types-legacy/ts4.5/tx/validator.d.ts +3 -5
- package/types-legacy/ts4.5/utils/errors.d.ts +3 -8
- package/types-legacy/ts4.5/utils/other.d.ts +1 -1
- package/es/contract/CompilerHttp.d.ts +0 -18
- package/es/contract/CompilerHttp.mjs.map +0 -1
- package/es/tx/builder/field-types/addresses.d.ts +0 -6
- package/es/tx/builder/field-types/addresses.mjs +0 -13
- package/es/tx/builder/field-types/addresses.mjs.map +0 -1
- package/es/utils/mptree.d.ts +0 -26
- package/es/utils/mptree.mjs +0 -143
- package/es/utils/mptree.mjs.map +0 -1
- package/src/contract/CompilerHttp.ts +0 -67
- package/src/tx/builder/field-types/addresses.ts +0 -18
- package/src/utils/mptree.ts +0 -145
- package/types-legacy/ts4.2/contract/CompilerHttp.d.ts +0 -18
- package/types-legacy/ts4.2/tx/builder/field-types/addresses.d.ts +0 -6
- package/types-legacy/ts4.2/utils/mptree.d.ts +0 -32
- package/types-legacy/ts4.5/contract/CompilerHttp.d.ts +0 -18
- package/types-legacy/ts4.5/tx/builder/field-types/addresses.d.ts +0 -6
- package/types-legacy/ts4.5/utils/mptree.d.ts +0 -32
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
15
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { RestError } from '@azure/core-rest-pipeline';
|
|
18
|
+
import { Compiler as CompilerApi } from "../../apis/compiler/index.mjs";
|
|
19
|
+
import { genErrorFormatterPolicy, genVersionCheckPolicy } from "../../utils/autorest.mjs";
|
|
20
|
+
import CompilerBase from "./Base.mjs";
|
|
21
|
+
import { CompilerError, NotImplementedError } from "../../utils/errors.mjs";
|
|
19
22
|
/**
|
|
20
23
|
* Contract Compiler over HTTP
|
|
21
24
|
*
|
|
@@ -23,7 +26,7 @@ import { genErrorFormatterPolicy, genVersionCheckPolicy } from "../utils/autores
|
|
|
23
26
|
* @category contract
|
|
24
27
|
* @example CompilerHttp('COMPILER_URL')
|
|
25
28
|
*/
|
|
26
|
-
export default class CompilerHttp extends
|
|
29
|
+
export default class CompilerHttp extends CompilerBase {
|
|
27
30
|
/**
|
|
28
31
|
* @param compilerUrl - Url for compiler API
|
|
29
32
|
* @param options - Options
|
|
@@ -33,7 +36,8 @@ export default class CompilerHttp extends CompilerApi {
|
|
|
33
36
|
let {
|
|
34
37
|
ignoreVersion
|
|
35
38
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
36
|
-
super(
|
|
39
|
+
super();
|
|
40
|
+
this.api = new CompilerApi(compilerUrl, {
|
|
37
41
|
allowInsecureConnection: true,
|
|
38
42
|
additionalPolicies: [genErrorFormatterPolicy(body => {
|
|
39
43
|
let message = '';
|
|
@@ -43,21 +47,72 @@ export default class CompilerHttp extends CompilerApi {
|
|
|
43
47
|
}${body.info != null ? ` (${JSON.stringify(body.info)})` : ''}`;
|
|
44
48
|
}
|
|
45
49
|
if (Array.isArray(body)) {
|
|
46
|
-
message += `\n${body.map(e => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context != null ? `(${e.context})` : ''}`).
|
|
47
|
-
.join('\n')}`;
|
|
50
|
+
message += `\n${body.map(e => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context != null ? `(${e.context})` : ''}`).join('\n')}`;
|
|
48
51
|
}
|
|
49
52
|
return message;
|
|
50
53
|
})]
|
|
51
54
|
});
|
|
52
55
|
if (ignoreVersion !== true) {
|
|
53
|
-
const versionPromise = this.apiVersion().then(_ref => {
|
|
56
|
+
const versionPromise = this.api.apiVersion().then(_ref => {
|
|
54
57
|
let {
|
|
55
58
|
apiVersion
|
|
56
59
|
} = _ref;
|
|
57
60
|
return apiVersion;
|
|
58
61
|
});
|
|
59
|
-
this.pipeline.addPolicy(genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.0.1', '8.0.0'));
|
|
62
|
+
this.api.pipeline.addPolicy(genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.0.1', '8.0.0'));
|
|
60
63
|
}
|
|
61
64
|
}
|
|
65
|
+
async compileBySourceCode(sourceCode, fileSystem) {
|
|
66
|
+
try {
|
|
67
|
+
const [bytecode, aci] = await Promise.all([this.api.compileContract({
|
|
68
|
+
code: sourceCode,
|
|
69
|
+
options: {
|
|
70
|
+
fileSystem
|
|
71
|
+
}
|
|
72
|
+
}).then(res => res.bytecode), this.api.generateACI({
|
|
73
|
+
code: sourceCode,
|
|
74
|
+
options: {
|
|
75
|
+
fileSystem
|
|
76
|
+
}
|
|
77
|
+
})]);
|
|
78
|
+
// TODO: should be fixed when the compiledAci interface gets updated
|
|
79
|
+
return {
|
|
80
|
+
bytecode,
|
|
81
|
+
aci: aci
|
|
82
|
+
};
|
|
83
|
+
} catch (error) {
|
|
84
|
+
if (error instanceof RestError && error.statusCode === 400) {
|
|
85
|
+
throw new CompilerError(error.message.replace(/^aci error:/, 'compile error:'));
|
|
86
|
+
}
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
92
|
+
async compile(path) {
|
|
93
|
+
throw new NotImplementedError('File system access, use CompilerHttpNode instead');
|
|
94
|
+
}
|
|
95
|
+
async validateBySourceCode(bytecode, sourceCode, fileSystem) {
|
|
96
|
+
try {
|
|
97
|
+
await this.api.validateByteCode({
|
|
98
|
+
bytecode,
|
|
99
|
+
source: sourceCode,
|
|
100
|
+
options: {
|
|
101
|
+
fileSystem
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return true;
|
|
105
|
+
} catch {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
111
|
+
async validate(bytecode, path) {
|
|
112
|
+
throw new NotImplementedError('File system access, use CompilerHttpNode instead');
|
|
113
|
+
}
|
|
114
|
+
async version() {
|
|
115
|
+
return (await this.api.version()).version;
|
|
116
|
+
}
|
|
62
117
|
}
|
|
63
|
-
//# sourceMappingURL=
|
|
118
|
+
//# sourceMappingURL=Http.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Http.mjs","names":["RestError","Compiler","CompilerApi","genErrorFormatterPolicy","genVersionCheckPolicy","CompilerBase","CompilerError","NotImplementedError","CompilerHttp","constructor","compilerUrl","ignoreVersion","api","allowInsecureConnection","additionalPolicies","body","message","reason","parameter","info","JSON","stringify","Array","isArray","map","e","type","pos","line","col","context","join","versionPromise","apiVersion","then","pipeline","addPolicy","compileBySourceCode","sourceCode","fileSystem","bytecode","aci","Promise","all","compileContract","code","options","res","generateACI","error","statusCode","replace","compile","path","validateBySourceCode","validateByteCode","source","validate","version"],"sources":["../../../src/contract/compiler/Http.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\nimport { 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().then(({ apiVersion }) => apiVersion);\n this.api.pipeline.addPolicy(\n genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.0.1', '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 [bytecode, aci] = await Promise.all([\n this.api.compileContract({ code: sourceCode, options: { fileSystem } })\n .then((res) => res.bytecode as Encoded.ContractBytearray),\n this.api.generateACI({ code: sourceCode, options: { fileSystem } }),\n ]);\n // TODO: should be fixed when the compiledAci interface gets updated\n return { bytecode, aci: aci as Aci };\n } catch (error) {\n if (error instanceof RestError && error.statusCode === 400) {\n throw new CompilerError(error.message.replace(/^aci error:/, 'compile error:'));\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 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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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,WAAW,CAACC,WAAmB,EAAuD;IAAA,IAArD;MAAEC;IAA2C,CAAC,uEAAG,CAAC,CAAC;IAClF,KAAK,EAAE;IACP,IAAI,CAACC,GAAG,GAAG,IAAIV,WAAW,CAACQ,WAAW,EAAE;MACtCG,uBAAuB,EAAE,IAAI;MAC7BC,kBAAkB,EAAE,CAClBX,uBAAuB,CAAEY,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,IAAI,CAACI,IAAI,IAAI,IAAI,GAAI,KAAIC,IAAI,CAACC,SAAS,CAACN,IAAI,CAACI,IAAI,CAAE,GAAE,GAAG,EAAG,EAAC;QACjE;QACA,IAAIG,KAAK,CAACC,OAAO,CAACR,IAAI,CAAC,EAAE;UACvBC,OAAO,IAAK,KAAID,IAAI,CACjBS,GAAG,CAAEC,CAAC,IAAM,GAAEA,CAAC,CAACC,IAAK,IAAGD,CAAC,CAACE,GAAG,CAACC,IAAK,IAAGH,CAAC,CAACE,GAAG,CAACE,GAAI,KAAIJ,CAAC,CAACT,OAAQ,GAAES,CAAC,CAACK,OAAO,IAAI,IAAI,GAAI,IAAGL,CAAC,CAACK,OAAQ,GAAE,GAAG,EAAG,EAAC,CAAC,CAC5GC,IAAI,CAAC,IAAI,CAAE,EAAC;QACjB;QACA,OAAOf,OAAO;MAChB,CAAC,CAAC;IAEN,CAAC,CAAC;IACF,IAAIL,aAAa,KAAK,IAAI,EAAE;MAC1B,MAAMqB,cAAc,GAAG,IAAI,CAACpB,GAAG,CAACqB,UAAU,EAAE,CAACC,IAAI,CAAC;QAAA,IAAC;UAAED;QAAW,CAAC;QAAA,OAAKA,UAAU;MAAA,EAAC;MACjF,IAAI,CAACrB,GAAG,CAACuB,QAAQ,CAACC,SAAS,CACzBhC,qBAAqB,CAAC,UAAU,EAAE,cAAc,EAAE4B,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,CACpF;IACH;EACF;EAEA,MAAMK,mBAAmB,CACvBC,UAAkB,EAClBC,UAAmC,EACyB;IAC5D,IAAI;MACF,MAAM,CAACC,QAAQ,EAAEC,GAAG,CAAC,GAAG,MAAMC,OAAO,CAACC,GAAG,CAAC,CACxC,IAAI,CAAC/B,GAAG,CAACgC,eAAe,CAAC;QAAEC,IAAI,EAAEP,UAAU;QAAEQ,OAAO,EAAE;UAAEP;QAAW;MAAE,CAAC,CAAC,CACpEL,IAAI,CAAEa,GAAG,IAAKA,GAAG,CAACP,QAAqC,CAAC,EAC3D,IAAI,CAAC5B,GAAG,CAACoC,WAAW,CAAC;QAAEH,IAAI,EAAEP,UAAU;QAAEQ,OAAO,EAAE;UAAEP;QAAW;MAAE,CAAC,CAAC,CACpE,CAAC;MACF;MACA,OAAO;QAAEC,QAAQ;QAAEC,GAAG,EAAEA;MAAW,CAAC;IACtC,CAAC,CAAC,OAAOQ,KAAK,EAAE;MACd,IAAIA,KAAK,YAAYjD,SAAS,IAAIiD,KAAK,CAACC,UAAU,KAAK,GAAG,EAAE;QAC1D,MAAM,IAAI5C,aAAa,CAAC2C,KAAK,CAACjC,OAAO,CAACmC,OAAO,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;MACjF;MACA,MAAMF,KAAK;IACb;EACF;;EAEA;EACA,MAAMG,OAAO,CAACC,IAAY,EAA8D;IACtF,MAAM,IAAI9C,mBAAmB,CAAC,kDAAkD,CAAC;EACnF;EAEA,MAAM+C,oBAAoB,CACxBd,QAAmC,EACnCF,UAAkB,EAClBC,UAAmC,EACjB;IAClB,IAAI;MACF,MAAM,IAAI,CAAC3B,GAAG,CAAC2C,gBAAgB,CAAC;QAAEf,QAAQ;QAAEgB,MAAM,EAAElB,UAAU;QAAEQ,OAAO,EAAE;UAAEP;QAAW;MAAE,CAAC,CAAC;MAC1F,OAAO,IAAI;IACb,CAAC,CAAC,MAAM;MACN,OAAO,KAAK;IACd;EACF;;EAEA;EACA,MAAMkB,QAAQ,CAACjB,QAAmC,EAAEa,IAAY,EAAoB;IAClF,MAAM,IAAI9C,mBAAmB,CAAC,kDAAkD,CAAC;EACnF;EAEA,MAAMmD,OAAO,GAAoB;IAC/B,OAAO,CAAC,MAAM,IAAI,CAAC9C,GAAG,CAAC8C,OAAO,EAAE,EAAEA,OAAO;EAC3C;AACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import HttpBrowser from './Http';
|
|
2
|
+
import { Aci } from './Base';
|
|
3
|
+
import { Encoded } from '../../utils/encoder';
|
|
4
|
+
/**
|
|
5
|
+
* Contract Compiler over HTTP for Nodejs
|
|
6
|
+
*
|
|
7
|
+
* Inherits CompilerHttp and implements `compile`, `validate` methods
|
|
8
|
+
* @category contract
|
|
9
|
+
* @example CompilerHttpNode('COMPILER_URL')
|
|
10
|
+
*/
|
|
11
|
+
export default class CompilerHttpNode extends HttpBrowser {
|
|
12
|
+
compile(path: string): Promise<{
|
|
13
|
+
bytecode: Encoded.ContractBytearray;
|
|
14
|
+
aci: Aci;
|
|
15
|
+
}>;
|
|
16
|
+
validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _fsPromises from 'fs/promises';
|
|
2
|
+
const {
|
|
3
|
+
readFile
|
|
4
|
+
} = _fsPromises;
|
|
5
|
+
import HttpBrowser from "./Http.mjs";
|
|
6
|
+
import getFileSystem from "./getFileSystem.mjs";
|
|
7
|
+
/**
|
|
8
|
+
* Contract Compiler over HTTP for Nodejs
|
|
9
|
+
*
|
|
10
|
+
* Inherits CompilerHttp and implements `compile`, `validate` methods
|
|
11
|
+
* @category contract
|
|
12
|
+
* @example CompilerHttpNode('COMPILER_URL')
|
|
13
|
+
*/
|
|
14
|
+
export default class CompilerHttpNode extends HttpBrowser {
|
|
15
|
+
async compile(path) {
|
|
16
|
+
const fileSystem = await getFileSystem(path);
|
|
17
|
+
const sourceCode = await readFile(path, 'utf8');
|
|
18
|
+
return this.compileBySourceCode(sourceCode, fileSystem);
|
|
19
|
+
}
|
|
20
|
+
async validate(bytecode, path) {
|
|
21
|
+
const fileSystem = await getFileSystem(path);
|
|
22
|
+
const sourceCode = await readFile(path, 'utf8');
|
|
23
|
+
return this.validateBySourceCode(bytecode, sourceCode, fileSystem);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=HttpNode.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpNode.mjs","names":["HttpBrowser","getFileSystem","CompilerHttpNode","compile","path","fileSystem","sourceCode","readFile","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,wBAAyB,aAAa;AAAC;EAAA;AAAA;AAAA,OAChCA,WAAW;AAAA,OAGXC,aAAa;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,WAAW,CAAC;EACxD,MAAeG,OAAO,CAACC,IAAY,EAA8D;IAC/F,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMC,QAAQ,CAACH,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACI,mBAAmB,CAACF,UAAU,EAAED,UAAU,CAAC;EACzD;EAEA,MAAeI,QAAQ,CAACC,QAAmC,EAAEN,IAAY,EAAoB;IAC3F,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMC,QAAQ,CAACH,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACO,oBAAoB,CAACD,QAAQ,EAAEJ,UAAU,EAAED,UAAU,CAAC;EACpE;AACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _flagsInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flags";
|
|
2
|
+
import _fsPromises from 'fs/promises';
|
|
3
|
+
const {
|
|
4
|
+
readFile
|
|
5
|
+
} = _fsPromises;
|
|
6
|
+
import _path from 'path';
|
|
7
|
+
const {
|
|
8
|
+
dirname,
|
|
9
|
+
resolve,
|
|
10
|
+
basename
|
|
11
|
+
} = _path;
|
|
12
|
+
import { InternalError } from "../../utils/errors.mjs";
|
|
13
|
+
const defaultIncludes = ['List.aes', 'Option.aes', 'String.aes', 'Func.aes', 'Pair.aes', 'Triple.aes', 'BLS12_381.aes', 'Frac.aes', 'Set.aes', 'Bitwise.aes'];
|
|
14
|
+
const includeRegExp = /^include\s*"([\w/.-]+)"/mi;
|
|
15
|
+
const includesRegExp = new RegExp(includeRegExp.source, `${_flagsInstanceProperty(includeRegExp)}g`);
|
|
16
|
+
async function getFileSystemRec(root, relative) {
|
|
17
|
+
var _sourceCode$match;
|
|
18
|
+
const sourceCode = await readFile(resolve(root, relative), 'utf8');
|
|
19
|
+
const filesystem = {};
|
|
20
|
+
await Promise.all(((_sourceCode$match = sourceCode.match(includesRegExp)) !== null && _sourceCode$match !== void 0 ? _sourceCode$match : []).map(include => {
|
|
21
|
+
const m = include.match(includeRegExp);
|
|
22
|
+
if ((m === null || m === void 0 ? void 0 : m.length) !== 2) throw new InternalError('Unexpected match length');
|
|
23
|
+
return m[1];
|
|
24
|
+
}).filter(include => !defaultIncludes.includes(include)).map(async include => {
|
|
25
|
+
const includePath = resolve(root, include);
|
|
26
|
+
filesystem[include] = await readFile(includePath, 'utf8');
|
|
27
|
+
Object.assign(filesystem, await getFileSystemRec(root, include));
|
|
28
|
+
}));
|
|
29
|
+
return filesystem;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Reads all files included in the provided contract
|
|
34
|
+
* Available only in Node.js
|
|
35
|
+
* @param path - a path to the main contract source code
|
|
36
|
+
*/
|
|
37
|
+
export default async function getFileSystem(path) {
|
|
38
|
+
return getFileSystemRec(dirname(path), basename(path));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=getFileSystem.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFileSystem.mjs","names":["InternalError","defaultIncludes","includeRegExp","includesRegExp","RegExp","source","getFileSystemRec","root","relative","sourceCode","readFile","resolve","filesystem","Promise","all","match","map","include","m","length","filter","includes","includePath","Object","assign","getFileSystem","path","dirname","basename"],"sources":["../../../src/contract/compiler/getFileSystem.ts"],"sourcesContent":["import { readFile } from 'fs/promises';\nimport { dirname, resolve, basename } from 'path';\nimport { InternalError } from '../../utils/errors';\n\nconst defaultIncludes = [\n 'List.aes', 'Option.aes', 'String.aes',\n 'Func.aes', 'Pair.aes', 'Triple.aes',\n 'BLS12_381.aes', 'Frac.aes', 'Set.aes',\n 'Bitwise.aes',\n];\nconst includeRegExp = /^include\\s*\"([\\w/.-]+)\"/mi;\nconst includesRegExp = new RegExp(includeRegExp.source, `${includeRegExp.flags}g`);\n\nasync function getFileSystemRec(\n root: string,\n relative: string,\n): Promise<Record<string, string>> {\n const sourceCode = await readFile(resolve(root, relative), 'utf8');\n const filesystem: Record<string, string> = {};\n await Promise.all((sourceCode.match(includesRegExp) ?? [])\n .map((include) => {\n const m = include.match(includeRegExp);\n if (m?.length !== 2) throw new InternalError('Unexpected match length');\n return m[1];\n })\n .filter((include) => !defaultIncludes.includes(include))\n .map(async (include) => {\n const includePath = resolve(root, include);\n filesystem[include] = await readFile(includePath, 'utf8');\n Object.assign(filesystem, await getFileSystemRec(root, include));\n }));\n return filesystem;\n}\n\n/**\n * Reads all files included in the provided contract\n * Available only in Node.js\n * @param path - a path to the main contract source code\n */\nexport default async function getFileSystem(path: string): Promise<Record<string, string>> {\n return getFileSystemRec(dirname(path), basename(path));\n}\n"],"mappings":";AAAA,wBAAyB,aAAa;AAAC;EAAA;AAAA;AACvC,kBAA2C,MAAM;AAAC;EAAA;EAAA;EAAA;AAAA;AAAA,SACzCA,aAAa;AAEtB,MAAMC,eAAe,GAAG,CACtB,UAAU,EAAE,YAAY,EAAE,YAAY,EACtC,UAAU,EAAE,UAAU,EAAE,YAAY,EACpC,eAAe,EAAE,UAAU,EAAE,SAAS,EACtC,aAAa,CACd;AACD,MAAMC,aAAa,GAAG,2BAA2B;AACjD,MAAMC,cAAc,GAAG,IAAIC,MAAM,CAACF,aAAa,CAACG,MAAM,EAAG,0BAAEH,aAAa,CAAO,GAAE,CAAC;AAElF,eAAeI,gBAAgB,CAC7BC,IAAY,EACZC,QAAgB,EACiB;EAAA;EACjC,MAAMC,UAAU,GAAG,MAAMC,QAAQ,CAACC,OAAO,CAACJ,IAAI,EAAEC,QAAQ,CAAC,EAAE,MAAM,CAAC;EAClE,MAAMI,UAAkC,GAAG,CAAC,CAAC;EAC7C,MAAMC,OAAO,CAACC,GAAG,CAAC,sBAACL,UAAU,CAACM,KAAK,CAACZ,cAAc,CAAC,iEAAI,EAAE,EACtDa,GAAG,CAAEC,OAAO,IAAK;IAChB,MAAMC,CAAC,GAAGD,OAAO,CAACF,KAAK,CAACb,aAAa,CAAC;IACtC,IAAI,CAAAgB,CAAC,aAADA,CAAC,uBAADA,CAAC,CAAEC,MAAM,MAAK,CAAC,EAAE,MAAM,IAAInB,aAAa,CAAC,yBAAyB,CAAC;IACvE,OAAOkB,CAAC,CAAC,CAAC,CAAC;EACb,CAAC,CAAC,CACDE,MAAM,CAAEH,OAAO,IAAK,CAAChB,eAAe,CAACoB,QAAQ,CAACJ,OAAO,CAAC,CAAC,CACvDD,GAAG,CAAC,MAAOC,OAAO,IAAK;IACtB,MAAMK,WAAW,GAAGX,OAAO,CAACJ,IAAI,EAAEU,OAAO,CAAC;IAC1CL,UAAU,CAACK,OAAO,CAAC,GAAG,MAAMP,QAAQ,CAACY,WAAW,EAAE,MAAM,CAAC;IACzDC,MAAM,CAACC,MAAM,CAACZ,UAAU,EAAE,MAAMN,gBAAgB,CAACC,IAAI,EAAEU,OAAO,CAAC,CAAC;EAClE,CAAC,CAAC,CAAC;EACL,OAAOL,UAAU;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAea,aAAa,CAACC,IAAY,EAAmC;EACzF,OAAOpB,gBAAgB,CAACqB,OAAO,CAACD,IAAI,CAAC,EAAEE,QAAQ,CAACF,IAAI,CAAC,CAAC;AACxD"}
|
package/es/contract/ga.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ import { Tag } from '../tx/builder/constants';
|
|
|
5
5
|
import { BuildTxOptions } from '../tx';
|
|
6
6
|
import { Encoded } from '../utils/encoder';
|
|
7
7
|
import AccountBase from '../account/Base';
|
|
8
|
+
import Contract from './Contract';
|
|
8
9
|
import { SendOptions } from '../spend';
|
|
9
10
|
import Node from '../Node';
|
|
10
|
-
import
|
|
11
|
+
import CompilerBase from './compiler/Base';
|
|
11
12
|
/**
|
|
12
13
|
* Convert current account to GA
|
|
13
14
|
* @category contract
|
|
@@ -17,15 +18,15 @@ import CompilerHttp from './CompilerHttp';
|
|
|
17
18
|
* @param options - Options
|
|
18
19
|
* @returns General Account Object
|
|
19
20
|
*/
|
|
20
|
-
export declare function createGeneralizedAccount(authFnName: string,
|
|
21
|
+
export declare function createGeneralizedAccount(authFnName: string, args: any[], { onAccount, onCompiler, onNode, bytecode, aci, sourceCodePath, sourceCode, fileSystem, ...options }: CreateGeneralizedAccountOptions): Promise<Readonly<{
|
|
21
22
|
owner: Encoded.AccountAddress;
|
|
22
23
|
transaction: Encoded.TxHash;
|
|
23
24
|
rawTx: Encoded.Transaction;
|
|
24
25
|
gaContractId: Encoded.ContractAddress;
|
|
25
26
|
}>>;
|
|
26
|
-
interface CreateGeneralizedAccountOptions extends BuildTxOptions<Tag.GaAttachTx, 'authFun' | 'callData' | 'code' | 'ownerId' | 'gasLimit'>, SendOptions {
|
|
27
|
+
interface CreateGeneralizedAccountOptions extends BuildTxOptions<Tag.GaAttachTx, 'authFun' | 'callData' | 'code' | 'ownerId' | 'gasLimit'>, SendOptions, Pick<Parameters<typeof Contract.initialize>[0], 'bytecode' | 'aci' | 'sourceCodePath' | 'sourceCode' | 'fileSystem'> {
|
|
27
28
|
onAccount: AccountBase;
|
|
28
|
-
onCompiler:
|
|
29
|
+
onCompiler: CompilerBase;
|
|
29
30
|
onNode: Node;
|
|
30
31
|
gasLimit?: number;
|
|
31
32
|
}
|
package/es/contract/ga.mjs
CHANGED
|
@@ -40,12 +40,17 @@ import { getAccount } from "../chain.mjs";
|
|
|
40
40
|
* @param options - Options
|
|
41
41
|
* @returns General Account Object
|
|
42
42
|
*/
|
|
43
|
-
export async function createGeneralizedAccount(authFnName,
|
|
43
|
+
export async function createGeneralizedAccount(authFnName, args, _ref) {
|
|
44
44
|
var _options$gasLimit;
|
|
45
45
|
let {
|
|
46
46
|
onAccount,
|
|
47
47
|
onCompiler,
|
|
48
48
|
onNode,
|
|
49
|
+
bytecode,
|
|
50
|
+
aci,
|
|
51
|
+
sourceCodePath,
|
|
52
|
+
sourceCode,
|
|
53
|
+
fileSystem,
|
|
49
54
|
...options
|
|
50
55
|
} = _ref;
|
|
51
56
|
const ownerId = onAccount.address;
|
|
@@ -58,7 +63,11 @@ export async function createGeneralizedAccount(authFnName, sourceCode, args, _re
|
|
|
58
63
|
onAccount,
|
|
59
64
|
onCompiler,
|
|
60
65
|
onNode,
|
|
61
|
-
|
|
66
|
+
bytecode,
|
|
67
|
+
aci,
|
|
68
|
+
sourceCodePath,
|
|
69
|
+
sourceCode,
|
|
70
|
+
fileSystem
|
|
62
71
|
});
|
|
63
72
|
const tx = await _buildTx(Tag.GaAttachTx, {
|
|
64
73
|
...options,
|
package/es/contract/ga.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ga.mjs","names":["Tag","buildContractIdByContractTx","_buildTx","hash","decode","IllegalArgumentError","concatBuffers","Contract","send","getAccount","createGeneralizedAccount","authFnName","
|
|
1
|
+
{"version":3,"file":"ga.mjs","names":["Tag","buildContractIdByContractTx","_buildTx","hash","decode","IllegalArgumentError","concatBuffers","Contract","send","getAccount","createGeneralizedAccount","authFnName","args","onAccount","onCompiler","onNode","bytecode","aci","sourceCodePath","sourceCode","fileSystem","options","ownerId","address","kind","contract","initialize","tx","GaAttachTx","code","$compile","gasLimit","_estimateGas","callData","_calldata","encode","_name","authFun","contractId","transaction","rawTx","Object","freeze","owner","gaContractId","buildAuthTxHash","Uint8Array","from","getNetworkId"],"sources":["../../src/contract/ga.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Generalized Account module - routines to use generalized account\n */\n\nimport { Tag } from '../tx/builder/constants';\nimport { buildContractIdByContractTx } from '../tx/builder';\nimport { _buildTx, BuildTxOptions } from '../tx';\nimport { hash } from '../utils/crypto';\nimport { decode, Encoded } from '../utils/encoder';\nimport { IllegalArgumentError } from '../utils/errors';\nimport { concatBuffers } from '../utils/other';\nimport AccountBase from '../account/Base';\nimport Contract from './Contract';\nimport { send, SendOptions } from '../spend';\nimport Node from '../Node';\nimport { getAccount } from '../chain';\nimport CompilerBase from './compiler/Base';\n\n/**\n * Convert current account to GA\n * @category contract\n * @param authFnName - Authorization function name\n * @param sourceCode - Auth contract source code\n * @param args - init arguments\n * @param options - Options\n * @returns General Account Object\n */\nexport async function createGeneralizedAccount(\n authFnName: string,\n args: any[],\n {\n onAccount, onCompiler, onNode, bytecode, aci, sourceCodePath, sourceCode, fileSystem, ...options\n }: CreateGeneralizedAccountOptions,\n): Promise<Readonly<{\n owner: Encoded.AccountAddress;\n transaction: Encoded.TxHash;\n rawTx: Encoded.Transaction;\n gaContractId: Encoded.ContractAddress;\n }>> {\n const ownerId = onAccount.address;\n if ((await getAccount(ownerId, { onNode })).kind === 'generalized') {\n throw new IllegalArgumentError(`Account ${ownerId} is already GA`);\n }\n\n const contract = await Contract.initialize<{ init: (...a: any[]) => void }>({\n onAccount, onCompiler, onNode, bytecode, aci, sourceCodePath, sourceCode, fileSystem,\n });\n\n const tx = await _buildTx(Tag.GaAttachTx, {\n ...options,\n onNode,\n code: await contract.$compile(),\n gasLimit: options.gasLimit ?? await contract._estimateGas('init', args, options),\n ownerId,\n callData: contract._calldata.encode(contract._name, 'init', args),\n authFun: hash(authFnName),\n });\n const contractId = buildContractIdByContractTx(tx);\n const { hash: transaction, rawTx } = await send(tx, {\n onNode, onAccount, onCompiler, ...options,\n });\n\n return Object.freeze({\n owner: ownerId,\n transaction,\n rawTx,\n gaContractId: contractId,\n });\n}\n\ninterface CreateGeneralizedAccountOptions extends\n BuildTxOptions<Tag.GaAttachTx, 'authFun' | 'callData' | 'code' | 'ownerId' | 'gasLimit'>,\n SendOptions,\n Pick<\n Parameters<typeof Contract.initialize>[0],\n 'bytecode' | 'aci' | 'sourceCodePath' | 'sourceCode' | 'fileSystem'\n > {\n onAccount: AccountBase;\n onCompiler: CompilerBase;\n onNode: Node;\n gasLimit?: number;\n}\n\n/**\n * Build a transaction hash the same as `Auth.tx_hash`\n * @category contract\n * @param transaction - tx-encoded transaction\n * @param options - Options\n * @param options.onNode - Node to use\n * @returns Transaction hash\n */\nexport async function buildAuthTxHash(\n transaction: Encoded.Transaction,\n { onNode }: { onNode: Node },\n): Promise<Uint8Array> {\n return new Uint8Array(hash(\n concatBuffers([Buffer.from(await onNode.getNetworkId()), decode(transaction)]),\n ));\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAFA,SAISA,GAAG;AAAA,SACHC,2BAA2B;AAAA,SAC3BC,QAAQ;AAAA,SACRC,IAAI;AAAA,SACJC,MAAM;AAAA,SACNC,oBAAoB;AAAA,SACpBC,aAAa;AAAA,OAEfC,QAAQ;AAAA,SACNC,IAAI;AAAA,SAEJC,UAAU;AAGnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwB,CAC5CC,UAAkB,EAClBC,IAAW,QASP;EAAA;EAAA,IARJ;IACEC,SAAS;IAAEC,UAAU;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,GAAG;IAAEC,cAAc;IAAEC,UAAU;IAAEC,UAAU;IAAE,GAAGC;EAC1D,CAAC;EAOlC,MAAMC,OAAO,GAAGT,SAAS,CAACU,OAAO;EACjC,IAAI,CAAC,MAAMd,UAAU,CAACa,OAAO,EAAE;IAAEP;EAAO,CAAC,CAAC,EAAES,IAAI,KAAK,aAAa,EAAE;IAClE,MAAM,IAAInB,oBAAoB,CAAE,WAAUiB,OAAQ,gBAAe,CAAC;EACpE;EAEA,MAAMG,QAAQ,GAAG,MAAMlB,QAAQ,CAACmB,UAAU,CAAkC;IAC1Eb,SAAS;IAAEC,UAAU;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,GAAG;IAAEC,cAAc;IAAEC,UAAU;IAAEC;EAC5E,CAAC,CAAC;EAEF,MAAMO,EAAE,GAAG,MAAMzB,QAAQ,CAACF,GAAG,CAAC4B,UAAU,EAAE;IACxC,GAAGP,OAAO;IACVN,MAAM;IACNc,IAAI,EAAE,MAAMJ,QAAQ,CAACK,QAAQ,EAAE;IAC/BC,QAAQ,uBAAEV,OAAO,CAACU,QAAQ,iEAAI,MAAMN,QAAQ,CAACO,YAAY,CAAC,MAAM,EAAEpB,IAAI,EAAES,OAAO,CAAC;IAChFC,OAAO;IACPW,QAAQ,EAAER,QAAQ,CAACS,SAAS,CAACC,MAAM,CAACV,QAAQ,CAACW,KAAK,EAAE,MAAM,EAAExB,IAAI,CAAC;IACjEyB,OAAO,EAAElC,IAAI,CAACQ,UAAU;EAC1B,CAAC,CAAC;EACF,MAAM2B,UAAU,GAAGrC,2BAA2B,CAAC0B,EAAE,CAAC;EAClD,MAAM;IAAExB,IAAI,EAAEoC,WAAW;IAAEC;EAAM,CAAC,GAAG,MAAMhC,IAAI,CAACmB,EAAE,EAAE;IAClDZ,MAAM;IAAEF,SAAS;IAAEC,UAAU;IAAE,GAAGO;EACpC,CAAC,CAAC;EAEF,OAAOoB,MAAM,CAACC,MAAM,CAAC;IACnBC,KAAK,EAAErB,OAAO;IACdiB,WAAW;IACXC,KAAK;IACLI,YAAY,EAAEN;EAChB,CAAC,CAAC;AACJ;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeO,eAAe,CACnCN,WAAgC,SAEX;EAAA,IADrB;IAAExB;EAAyB,CAAC;EAE5B,OAAO,IAAI+B,UAAU,CAAC3C,IAAI,CACxBG,aAAa,CAAC,CAAC,QAAOyC,IAAI,CAAC,MAAMhC,MAAM,CAACiC,YAAY,EAAE,CAAC,EAAE5C,MAAM,CAACmC,WAAW,CAAC,CAAC,CAAC,CAC/E,CAAC;AACJ"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export * from './chain';
|
|
2
|
+
export * from './utils/crypto';
|
|
3
|
+
export * from './utils/keystore';
|
|
4
|
+
export * from './utils/bytes';
|
|
5
|
+
export * from './tx';
|
|
6
|
+
export * from './tx/builder';
|
|
7
|
+
export * from './tx/builder/helpers';
|
|
8
|
+
export * from './tx/builder/constants';
|
|
9
|
+
export * from './tx/builder/schema';
|
|
10
|
+
export * from './utils/amount-formatter';
|
|
11
|
+
export * from './utils/hd-wallet';
|
|
12
|
+
export { encode, decode, Encoding } from './utils/encoder';
|
|
13
|
+
export * from './aens';
|
|
14
|
+
export { default as Contract } from './contract/Contract';
|
|
15
|
+
export type { ContractMethodsBase } from './contract/Contract';
|
|
16
|
+
export * from './oracle';
|
|
17
|
+
export * from './spend';
|
|
18
|
+
export * from './contract/ga';
|
|
19
|
+
export { default as AeSdkMethods } from './AeSdkMethods';
|
|
20
|
+
export { default as AeSdkBase } from './AeSdkBase';
|
|
21
|
+
export { default as AeSdk } from './AeSdk';
|
|
22
|
+
export { default as AeSdkAepp } from './AeSdkAepp';
|
|
23
|
+
export { default as AeSdkWallet } from './AeSdkWallet';
|
|
24
|
+
export { default as Node } from './Node';
|
|
25
|
+
export { default as verifyTransaction } from './tx/validator';
|
|
26
|
+
export { default as AccountBase } from './account/Base';
|
|
27
|
+
export { default as MemoryAccount } from './account/Memory';
|
|
28
|
+
export { default as AccountGeneralized } from './account/Generalized';
|
|
29
|
+
export { default as AccountLedger } from './account/Ledger';
|
|
30
|
+
export { default as AccountLedgerFactory } from './account/LedgerFactory';
|
|
31
|
+
export { default as CompilerBase } from './contract/compiler/Base';
|
|
32
|
+
export { default as CompilerHttp } from './contract/compiler/Http';
|
|
33
|
+
export { default as Channel } from './channel/Contract';
|
|
34
|
+
export { default as connectionProxy } from './aepp-wallet-communication/connection-proxy';
|
|
35
|
+
export * from './aepp-wallet-communication/schema';
|
|
36
|
+
export { default as walletDetector } from './aepp-wallet-communication/wallet-detector';
|
|
37
|
+
export { default as BrowserRuntimeConnection } from './aepp-wallet-communication/connection/BrowserRuntime';
|
|
38
|
+
export { default as BrowserWindowMessageConnection } from './aepp-wallet-communication/connection/BrowserWindowMessage';
|
|
39
|
+
export * from './utils/errors';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ISC License (ISC)
|
|
3
|
+
* Copyright (c) 2022 aeternity developers
|
|
4
|
+
*
|
|
5
|
+
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
* purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
* copyright notice and this permission notice appear in all copies.
|
|
8
|
+
*
|
|
9
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
* PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
*/
|
|
17
|
+
export * from "./chain.mjs";
|
|
18
|
+
export * from "./utils/crypto.mjs";
|
|
19
|
+
export * from "./utils/keystore.mjs";
|
|
20
|
+
export * from "./utils/bytes.mjs";
|
|
21
|
+
export * from "./tx/index.mjs";
|
|
22
|
+
export * from "./tx/builder/index.mjs";
|
|
23
|
+
export * from "./tx/builder/helpers.mjs";
|
|
24
|
+
export * from "./tx/builder/constants.mjs";
|
|
25
|
+
export * from "./tx/builder/schema.mjs";
|
|
26
|
+
export * from "./utils/amount-formatter.mjs";
|
|
27
|
+
export * from "./utils/hd-wallet.mjs";
|
|
28
|
+
export { encode, decode, Encoding } from "./utils/encoder.mjs";
|
|
29
|
+
export * from "./aens.mjs";
|
|
30
|
+
export { default as Contract } from "./contract/Contract.mjs";
|
|
31
|
+
export * from "./oracle.mjs";
|
|
32
|
+
export * from "./spend.mjs";
|
|
33
|
+
export * from "./contract/ga.mjs";
|
|
34
|
+
export { default as AeSdkMethods } from "./AeSdkMethods.mjs";
|
|
35
|
+
export { default as AeSdkBase } from "./AeSdkBase.mjs";
|
|
36
|
+
export { default as AeSdk } from "./AeSdk.mjs";
|
|
37
|
+
export { default as AeSdkAepp } from "./AeSdkAepp.mjs";
|
|
38
|
+
export { default as AeSdkWallet } from "./AeSdkWallet.mjs";
|
|
39
|
+
export { default as Node } from "./Node.mjs";
|
|
40
|
+
export { default as verifyTransaction } from "./tx/validator.mjs";
|
|
41
|
+
export { default as AccountBase } from "./account/Base.mjs";
|
|
42
|
+
export { default as MemoryAccount } from "./account/Memory.mjs";
|
|
43
|
+
export { default as AccountGeneralized } from "./account/Generalized.mjs";
|
|
44
|
+
export { default as AccountLedger } from "./account/Ledger.mjs";
|
|
45
|
+
export { default as AccountLedgerFactory } from "./account/LedgerFactory.mjs";
|
|
46
|
+
export { default as CompilerBase } from "./contract/compiler/Base.mjs";
|
|
47
|
+
export { default as CompilerHttp } from "./contract/compiler/Http.mjs";
|
|
48
|
+
export { default as Channel } from "./channel/Contract.mjs";
|
|
49
|
+
export { default as connectionProxy } from "./aepp-wallet-communication/connection-proxy.mjs";
|
|
50
|
+
export * from "./aepp-wallet-communication/schema.mjs";
|
|
51
|
+
export { default as walletDetector } from "./aepp-wallet-communication/wallet-detector.mjs";
|
|
52
|
+
export { default as BrowserRuntimeConnection } from "./aepp-wallet-communication/connection/BrowserRuntime.mjs";
|
|
53
|
+
export { default as BrowserWindowMessageConnection } from "./aepp-wallet-communication/connection/BrowserWindowMessage.mjs";
|
|
54
|
+
export * from "./utils/errors.mjs";
|
|
55
|
+
//# sourceMappingURL=index-browser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-browser.mjs","names":["encode","decode","Encoding","default","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":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\nexport * from './chain';\nexport * from './utils/crypto';\nexport * from './utils/keystore';\nexport * from './utils/bytes';\nexport * from './tx';\nexport * from './tx/builder';\nexport * from './tx/builder/helpers';\nexport * from './tx/builder/constants';\nexport * from './tx/builder/schema';\nexport * from './utils/amount-formatter';\nexport * from './utils/hd-wallet';\nexport { encode, decode, Encoding } 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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SA4BSA,MAAM,EAAEC,MAAM,EAAEC,QAAQ;AAAA;AAAA,SAExBC,OAAO,IAAIC,QAAQ;AAAA;AAAA;AAAA;AAAA,SAMnBD,OAAO,IAAIE,YAAY;AAAA,SACvBF,OAAO,IAAIG,SAAS;AAAA,SACpBH,OAAO,IAAII,KAAK;AAAA,SAChBJ,OAAO,IAAIK,SAAS;AAAA,SACpBL,OAAO,IAAIM,WAAW;AAAA,SACtBN,OAAO,IAAIO,IAAI;AAAA,SACfP,OAAO,IAAIQ,iBAAiB;AAAA,SAC5BR,OAAO,IAAIS,WAAW;AAAA,SACtBT,OAAO,IAAIU,aAAa;AAAA,SACxBV,OAAO,IAAIW,kBAAkB;AAAA,SAC7BX,OAAO,IAAIY,aAAa;AAAA,SACxBZ,OAAO,IAAIa,oBAAoB;AAAA,SAC/Bb,OAAO,IAAIc,YAAY;AAAA,SACvBd,OAAO,IAAIe,YAAY;AAAA,SACvBf,OAAO,IAAIgB,OAAO;AAAA,SAElBhB,OAAO,IAAIiB,eAAe;AAAA;AAAA,SAE1BjB,OAAO,IAAIkB,cAAc;AAAA,SACzBlB,OAAO,IAAImB,wBAAwB;AAAA,SACnCnB,OAAO,IAAIoB,8BAA8B;AAAA"}
|
package/es/index.d.ts
CHANGED
|
@@ -1,38 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export * from './tx';
|
|
6
|
-
export * from './tx/builder';
|
|
7
|
-
export * from './tx/builder/helpers';
|
|
8
|
-
export * from './tx/builder/constants';
|
|
9
|
-
export * from './tx/builder/schema';
|
|
10
|
-
export * from './utils/amount-formatter';
|
|
11
|
-
export * from './utils/hd-wallet';
|
|
12
|
-
export { encode, decode, Encoding } from './utils/encoder';
|
|
13
|
-
export * from './aens';
|
|
14
|
-
export { default as Contract } from './contract/Contract';
|
|
15
|
-
export type { ContractMethodsBase } from './contract/Contract';
|
|
16
|
-
export * from './oracle';
|
|
17
|
-
export * from './spend';
|
|
18
|
-
export * from './contract/ga';
|
|
19
|
-
export { default as AeSdkMethods } from './AeSdkMethods';
|
|
20
|
-
export { default as AeSdkBase } from './AeSdkBase';
|
|
21
|
-
export { default as AeSdk } from './AeSdk';
|
|
22
|
-
export { default as AeSdkAepp } from './AeSdkAepp';
|
|
23
|
-
export { default as AeSdkWallet } from './AeSdkWallet';
|
|
24
|
-
export { default as Node } from './Node';
|
|
25
|
-
export { default as verifyTransaction } from './tx/validator';
|
|
26
|
-
export { default as AccountBase } from './account/Base';
|
|
27
|
-
export { default as MemoryAccount } from './account/Memory';
|
|
28
|
-
export { default as AccountGeneralized } from './account/Generalized';
|
|
29
|
-
export { default as AccountLedger } from './account/Ledger';
|
|
30
|
-
export { default as AccountLedgerFactory } from './account/LedgerFactory';
|
|
31
|
-
export { default as CompilerHttp } from './contract/CompilerHttp';
|
|
32
|
-
export { default as Channel } from './channel/Contract';
|
|
33
|
-
export { default as connectionProxy } from './aepp-wallet-communication/connection-proxy';
|
|
34
|
-
export * from './aepp-wallet-communication/schema';
|
|
35
|
-
export { default as walletDetector } from './aepp-wallet-communication/wallet-detector';
|
|
36
|
-
export { default as BrowserRuntimeConnection } from './aepp-wallet-communication/connection/BrowserRuntime';
|
|
37
|
-
export { default as BrowserWindowMessageConnection } from './aepp-wallet-communication/connection/BrowserWindowMessage';
|
|
38
|
-
export * from './utils/errors';
|
|
1
|
+
export * from './index-browser';
|
|
2
|
+
export { default as CompilerCli } from './contract/compiler/Cli';
|
|
3
|
+
export { default as getFileSystem } from './contract/compiler/getFileSystem';
|
|
4
|
+
export { default as CompilerHttpNode } from './contract/compiler/HttpNode';
|
package/es/index.mjs
CHANGED
|
@@ -1,54 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
* copyright notice and this permission notice appear in all copies.
|
|
8
|
-
*
|
|
9
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
*/
|
|
17
|
-
export * from "./chain.mjs";
|
|
18
|
-
export * from "./utils/crypto.mjs";
|
|
19
|
-
export * from "./utils/keystore.mjs";
|
|
20
|
-
export * from "./utils/bytes.mjs";
|
|
21
|
-
export * from "./tx/index.mjs";
|
|
22
|
-
export * from "./tx/builder/index.mjs";
|
|
23
|
-
export * from "./tx/builder/helpers.mjs";
|
|
24
|
-
export * from "./tx/builder/constants.mjs";
|
|
25
|
-
export * from "./tx/builder/schema.mjs";
|
|
26
|
-
export * from "./utils/amount-formatter.mjs";
|
|
27
|
-
export * from "./utils/hd-wallet.mjs";
|
|
28
|
-
export { encode, decode, Encoding } from "./utils/encoder.mjs";
|
|
29
|
-
export * from "./aens.mjs";
|
|
30
|
-
export { default as Contract } from "./contract/Contract.mjs";
|
|
31
|
-
export * from "./oracle.mjs";
|
|
32
|
-
export * from "./spend.mjs";
|
|
33
|
-
export * from "./contract/ga.mjs";
|
|
34
|
-
export { default as AeSdkMethods } from "./AeSdkMethods.mjs";
|
|
35
|
-
export { default as AeSdkBase } from "./AeSdkBase.mjs";
|
|
36
|
-
export { default as AeSdk } from "./AeSdk.mjs";
|
|
37
|
-
export { default as AeSdkAepp } from "./AeSdkAepp.mjs";
|
|
38
|
-
export { default as AeSdkWallet } from "./AeSdkWallet.mjs";
|
|
39
|
-
export { default as Node } from "./Node.mjs";
|
|
40
|
-
export { default as verifyTransaction } from "./tx/validator.mjs";
|
|
41
|
-
export { default as AccountBase } from "./account/Base.mjs";
|
|
42
|
-
export { default as MemoryAccount } from "./account/Memory.mjs";
|
|
43
|
-
export { default as AccountGeneralized } from "./account/Generalized.mjs";
|
|
44
|
-
export { default as AccountLedger } from "./account/Ledger.mjs";
|
|
45
|
-
export { default as AccountLedgerFactory } from "./account/LedgerFactory.mjs";
|
|
46
|
-
export { default as CompilerHttp } from "./contract/CompilerHttp.mjs";
|
|
47
|
-
export { default as Channel } from "./channel/Contract.mjs";
|
|
48
|
-
export { default as connectionProxy } from "./aepp-wallet-communication/connection-proxy.mjs";
|
|
49
|
-
export * from "./aepp-wallet-communication/schema.mjs";
|
|
50
|
-
export { default as walletDetector } from "./aepp-wallet-communication/wallet-detector.mjs";
|
|
51
|
-
export { default as BrowserRuntimeConnection } from "./aepp-wallet-communication/connection/BrowserRuntime.mjs";
|
|
52
|
-
export { default as BrowserWindowMessageConnection } from "./aepp-wallet-communication/connection/BrowserWindowMessage.mjs";
|
|
53
|
-
export * from "./utils/errors.mjs";
|
|
1
|
+
export * from "./index-browser.mjs";
|
|
2
|
+
export { default as CompilerCli } from "./contract/compiler/Cli.mjs";
|
|
3
|
+
export { default as getFileSystem } from "./contract/compiler/getFileSystem.mjs";
|
|
4
|
+
export { default as CompilerHttpNode } from "./contract/compiler/HttpNode.mjs";
|
|
54
5
|
//# sourceMappingURL=index.mjs.map
|
package/es/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["default","CompilerCli","getFileSystem","CompilerHttpNode"],"sources":["../src/index.ts"],"sourcesContent":["export * from './index-browser';\n\nexport { default as CompilerCli } from './contract/compiler/Cli';\nexport { default as getFileSystem } from './contract/compiler/getFileSystem';\nexport { default as CompilerHttpNode } from './contract/compiler/HttpNode';\n"],"mappings":";SAESA,OAAO,IAAIC,WAAW;AAAA,SACtBD,OAAO,IAAIE,aAAa;AAAA,SACxBF,OAAO,IAAIG,gBAAgB"}
|
package/es/oracle.mjs
CHANGED
|
@@ -173,7 +173,7 @@ export async function postQueryToOracle(oracleId, query, options) {
|
|
|
173
173
|
});
|
|
174
174
|
const {
|
|
175
175
|
nonce
|
|
176
|
-
} = unpackTx(oracleQueryTx, Tag.OracleQueryTx)
|
|
176
|
+
} = unpackTx(oracleQueryTx, Tag.OracleQueryTx);
|
|
177
177
|
const queryId = oracleQueryId(senderId, nonce, oracleId);
|
|
178
178
|
return {
|
|
179
179
|
...(await send(oracleQueryTx, options)),
|