@aeternity/aepp-sdk 10.0.0 → 12.0.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/LICENSE +1 -1
- package/README.md +15 -14
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +13 -40
- 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 +1 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdk.d.ts +37 -0
- package/es/AeSdk.mjs +81 -0
- package/es/AeSdk.mjs.map +1 -0
- package/es/AeSdkAepp.d.ts +69 -0
- package/es/AeSdkAepp.mjs +175 -0
- package/es/AeSdkAepp.mjs.map +1 -0
- package/es/AeSdkBase.d.ts +212 -0
- package/es/AeSdkBase.mjs +310 -0
- package/es/AeSdkBase.mjs.map +1 -0
- package/es/AeSdkWallet.d.ts +103 -0
- package/es/AeSdkWallet.mjs +322 -0
- package/es/AeSdkWallet.mjs.map +1 -0
- package/es/Node.d.ts +44 -0
- package/es/Node.mjs +141 -0
- package/es/Node.mjs.map +1 -0
- package/es/account/Base.d.ts +65 -0
- package/es/account/Base.mjs +123 -0
- package/es/account/Base.mjs.map +1 -0
- package/es/account/Memory.d.ts +25 -0
- package/es/account/Memory.mjs +81 -0
- package/es/account/Memory.mjs.map +1 -0
- package/es/account/Rpc.d.ts +27 -0
- package/es/account/Rpc.mjs +79 -0
- package/es/account/Rpc.mjs.map +1 -0
- package/es/aens.d.ts +209 -0
- package/es/aens.mjs +332 -0
- package/es/aens.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection/Browser.d.ts +32 -0
- package/es/aepp-wallet-communication/connection/Browser.mjs +70 -0
- package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +17 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +57 -0
- package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +35 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +142 -0
- package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -0
- package/es/aepp-wallet-communication/connection-proxy.d.ts +10 -0
- package/{src/utils/crypto-ts.ts → es/aepp-wallet-communication/connection-proxy.mjs} +15 -11
- package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +33 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs +169 -0
- package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -0
- package/es/aepp-wallet-communication/rpc/types.d.ts +77 -0
- package/es/aepp-wallet-communication/rpc/types.mjs +3 -0
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -0
- package/es/aepp-wallet-communication/schema.d.ts +118 -0
- package/es/aepp-wallet-communication/schema.mjs +214 -0
- package/es/aepp-wallet-communication/schema.mjs.map +1 -0
- package/es/aepp-wallet-communication/wallet-detector.d.ts +24 -0
- package/es/aepp-wallet-communication/wallet-detector.mjs +63 -0
- package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
- package/es/apis/compiler/compiler.d.ts +92 -0
- package/es/apis/compiler/compiler.mjs +576 -0
- package/es/apis/compiler/compiler.mjs.map +1 -0
- package/es/apis/compiler/index.d.ts +2 -0
- package/es/apis/compiler/index.mjs +3 -0
- package/es/apis/compiler/index.mjs.map +1 -0
- package/es/apis/compiler/models/index.d.ts +248 -0
- package/es/apis/compiler/models/index.mjs +48 -0
- package/es/apis/compiler/models/index.mjs.map +1 -0
- package/es/apis/compiler/models/mappers.d.ts +23 -0
- package/es/apis/compiler/models/mappers.mjs +585 -0
- package/es/apis/compiler/models/mappers.mjs.map +1 -0
- package/es/apis/compiler/models/parameters.d.ts +13 -0
- package/es/apis/compiler/models/parameters.mjs +71 -0
- package/es/apis/compiler/models/parameters.mjs.map +1 -0
- package/es/apis/node/index.d.ts +2 -0
- package/es/apis/node/index.mjs +3 -0
- package/es/apis/node/index.mjs.map +1 -0
- package/es/apis/node/models/index.d.ts +1061 -0
- package/es/apis/node/models/index.mjs +2 -0
- package/es/apis/node/models/index.mjs.map +1 -0
- package/es/apis/node/models/mappers.d.ts +95 -0
- package/es/apis/node/models/mappers.mjs +4164 -0
- package/es/apis/node/models/mappers.mjs.map +1 -0
- package/es/apis/node/models/parameters.d.ts +17 -0
- package/es/apis/node/models/parameters.mjs +165 -0
- package/es/apis/node/models/parameters.mjs.map +1 -0
- package/es/apis/node/node.d.ts +215 -0
- package/es/apis/node/node.mjs +1165 -0
- package/es/apis/node/node.mjs.map +1 -0
- package/es/chain.d.ts +220 -0
- package/es/chain.mjs +524 -0
- package/es/chain.mjs.map +1 -0
- package/es/channel/handlers.d.ts +34 -0
- package/es/channel/{handlers.js → handlers.mjs} +163 -130
- package/es/channel/handlers.mjs.map +1 -0
- package/es/channel/index.d.ts +634 -0
- package/es/channel/index.mjs +978 -0
- package/es/channel/index.mjs.map +1 -0
- package/es/channel/internal.d.ts +100 -0
- package/es/channel/internal.mjs +328 -0
- package/es/channel/internal.mjs.map +1 -0
- package/es/contract/Compiler.d.ts +17 -0
- package/es/contract/Compiler.mjs +67 -0
- package/es/contract/Compiler.mjs.map +1 -0
- package/es/contract/aci.d.ts +125 -0
- package/es/contract/aci.mjs +496 -0
- package/es/contract/aci.mjs.map +1 -0
- package/es/contract/ga.d.ts +68 -0
- package/es/contract/ga.mjs +190 -0
- package/es/contract/ga.mjs.map +1 -0
- package/es/contract/methods.d.ts +68 -0
- package/es/contract/methods.mjs +101 -0
- package/es/contract/methods.mjs.map +1 -0
- package/es/index.d.ts +32 -0
- package/es/index.mjs +49 -0
- package/es/index.mjs.map +1 -0
- package/es/oracle.d.ts +154 -0
- package/es/oracle.mjs +288 -0
- package/es/oracle.mjs.map +1 -0
- package/es/spend.d.ts +61 -0
- package/es/spend.mjs +122 -0
- package/es/spend.mjs.map +1 -0
- package/es/tx/builder/constants.d.ts +41 -0
- package/es/tx/builder/constants.mjs +100 -0
- package/es/tx/builder/constants.mjs.map +1 -0
- package/es/tx/builder/field-types.d.ts +62 -0
- package/es/tx/builder/field-types.mjs +126 -0
- package/es/tx/builder/field-types.mjs.map +1 -0
- package/es/tx/builder/helpers.d.ts +131 -0
- package/es/tx/builder/helpers.mjs +223 -0
- package/es/tx/builder/helpers.mjs.map +1 -0
- package/es/tx/builder/index.d.ts +75 -0
- package/es/tx/builder/index.mjs +424 -0
- package/es/tx/builder/index.mjs.map +1 -0
- package/es/tx/builder/schema.d.ts +350 -0
- package/es/tx/builder/schema.mjs +320 -0
- package/es/tx/builder/schema.mjs.map +1 -0
- package/es/tx/index.d.ts +63 -0
- package/es/tx/index.mjs +209 -0
- package/es/tx/index.mjs.map +1 -0
- package/es/tx/min-fee.d.ts +20 -0
- package/es/tx/min-fee.mjs +148 -0
- package/es/tx/min-fee.mjs.map +1 -0
- package/es/tx/validator.d.ts +19 -0
- package/es/tx/validator.mjs +240 -0
- package/es/tx/validator.mjs.map +1 -0
- package/es/typings/@aeternity__argon2-browser/index.d.mjs +2 -0
- package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -0
- package/es/typings/@aeternity__uuid/index.d.mjs +2 -0
- package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -0
- package/es/typings/bip32-path/index.d.mjs +2 -0
- package/es/typings/bip32-path/index.d.mjs.map +1 -0
- package/es/typings/blakejs/index.d.mjs +2 -0
- package/es/typings/blakejs/index.d.mjs.map +1 -0
- package/es/typings/tweetnacl-auth/index.d.mjs +2 -0
- package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -0
- package/es/utils/amount-formatter.d.ts +42 -0
- package/es/utils/{amount-formatter.js → amount-formatter.mjs} +38 -44
- package/es/utils/amount-formatter.mjs.map +1 -0
- package/es/utils/autorest.d.ts +6 -0
- package/es/utils/autorest.mjs +97 -0
- package/es/utils/autorest.mjs.map +1 -0
- package/es/utils/bignumber.d.ts +13 -0
- package/es/utils/bignumber.mjs +23 -0
- package/es/utils/bignumber.mjs.map +1 -0
- package/es/{bytes.d.ts → utils/bytes.d.ts} +10 -13
- package/es/utils/{bytes.js → bytes.mjs} +26 -22
- package/es/utils/bytes.mjs.map +1 -0
- package/es/utils/crypto.d.ts +103 -0
- package/es/utils/crypto.mjs +221 -0
- package/es/utils/crypto.mjs.map +1 -0
- package/es/utils/encoder.d.ts +26 -0
- package/es/utils/encoder.mjs +102 -0
- package/es/utils/encoder.mjs.map +1 -0
- package/es/utils/errors.d.ts +481 -0
- package/es/utils/errors.mjs +882 -0
- package/es/utils/errors.mjs.map +1 -0
- package/es/utils/hd-wallet.d.ts +34 -0
- package/es/utils/hd-wallet.mjs +122 -0
- package/es/utils/hd-wallet.mjs.map +1 -0
- package/es/utils/json-big.d.ts +5 -0
- package/es/utils/json-big.mjs +41 -0
- package/es/utils/json-big.mjs.map +1 -0
- package/es/utils/keystore.d.ts +51 -0
- package/es/utils/keystore.mjs +145 -0
- package/es/utils/keystore.mjs.map +1 -0
- package/es/{mptree.d.ts → utils/mptree.d.ts} +5 -8
- package/es/utils/{mptree.js → mptree.mjs} +33 -25
- package/es/utils/mptree.mjs.map +1 -0
- package/es/utils/other.d.ts +14 -0
- package/es/utils/other.mjs +28 -0
- package/es/utils/other.mjs.map +1 -0
- package/es/{semver-satisfies.d.ts → utils/semver-satisfies.d.ts} +0 -0
- package/es/utils/{semver-satisfies.js → semver-satisfies.mjs} +1 -1
- package/es/utils/semver-satisfies.mjs.map +1 -0
- package/es/utils/string.d.ts +24 -0
- package/es/utils/{string.js → string.mjs} +9 -11
- package/es/utils/string.mjs.map +1 -0
- package/package.json +67 -64
- package/src/AeSdk.ts +65 -0
- package/src/AeSdkAepp.ts +167 -0
- package/src/AeSdkBase.ts +320 -0
- package/src/AeSdkWallet.ts +332 -0
- package/src/Node.ts +167 -0
- package/src/account/Base.ts +114 -0
- package/src/account/Memory.ts +83 -0
- package/src/account/Rpc.ts +67 -0
- package/src/aens.ts +391 -0
- package/src/aepp-wallet-communication/connection/Browser.ts +68 -0
- package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +58 -0
- package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +111 -0
- package/{es/utils/crypto-ts.js → src/aepp-wallet-communication/connection-proxy.ts} +16 -9
- package/src/aepp-wallet-communication/rpc/RpcClient.ts +137 -0
- package/src/aepp-wallet-communication/rpc/types.ts +66 -0
- package/src/aepp-wallet-communication/schema.ts +181 -0
- package/src/aepp-wallet-communication/wallet-detector.ts +71 -0
- package/src/apis/compiler/code-model-v4.yaml +2649 -0
- package/src/apis/compiler/compiler.ts +585 -0
- package/src/apis/compiler/index.ts +2 -0
- package/src/apis/compiler/models/index.ts +301 -0
- package/src/apis/compiler/models/mappers.ts +583 -0
- package/src/apis/compiler/models/parameters.ts +93 -0
- package/src/apis/node/code-model-v4.yaml +10046 -0
- package/src/apis/node/index.ts +2 -0
- package/src/apis/node/models/index.ts +1253 -0
- package/src/apis/node/models/mappers.ts +4278 -0
- package/src/apis/node/models/parameters.ts +188 -0
- package/src/apis/node/node.ts +1299 -0
- package/src/chain.ts +444 -0
- package/src/channel/{handlers.js → handlers.ts} +238 -143
- package/src/channel/index.ts +991 -0
- package/src/channel/internal.ts +345 -0
- package/src/contract/Compiler.ts +66 -0
- package/src/contract/aci.ts +529 -0
- package/src/contract/ga.ts +178 -0
- package/src/contract/methods.ts +118 -0
- package/src/index.ts +51 -0
- package/src/oracle.ts +342 -0
- package/src/spend.ts +152 -0
- package/src/tx/builder/constants.ts +96 -0
- package/src/tx/builder/field-types.ts +111 -0
- package/src/tx/builder/helpers.ts +253 -0
- package/src/tx/builder/index.ts +394 -0
- package/src/tx/builder/schema.ts +771 -0
- package/src/tx/index.ts +199 -0
- package/src/tx/min-fee.ts +136 -0
- package/src/tx/validator.ts +226 -0
- package/src/typings/@aeternity__argon2-browser/index.d.ts +3 -0
- package/src/typings/@aeternity__uuid/index.d.ts +3 -0
- package/src/typings/bip32-path/index.d.ts +33 -0
- package/src/typings/tweetnacl-auth/index.d.ts +14 -0
- package/src/utils/amount-formatter.ts +29 -41
- package/src/utils/autorest.ts +90 -0
- package/src/utils/bignumber.ts +9 -19
- package/src/utils/bytes.ts +15 -16
- package/src/utils/crypto.ts +217 -0
- package/src/utils/encoder.ts +98 -0
- package/src/utils/errors.ts +817 -0
- package/src/utils/hd-wallet.ts +134 -0
- package/src/utils/json-big.ts +26 -0
- package/src/utils/keystore.ts +179 -0
- package/src/utils/mptree.ts +26 -20
- package/src/utils/other.ts +28 -43
- package/src/utils/string.ts +8 -10
- package/CHANGELOG.md +0 -1603
- package/es/account/base.js +0 -169
- package/es/account/base.js.map +0 -1
- package/es/account/memory.js +0 -84
- package/es/account/memory.js.map +0 -1
- package/es/account/multiple.js +0 -178
- package/es/account/multiple.js.map +0 -1
- package/es/ae/aens.js +0 -408
- package/es/ae/aens.js.map +0 -1
- package/es/ae/aepp.js +0 -45
- package/es/ae/aepp.js.map +0 -1
- package/es/ae/contract.js +0 -312
- package/es/ae/contract.js.map +0 -1
- package/es/ae/index.js +0 -206
- package/es/ae/index.js.map +0 -1
- package/es/ae/oracle.js +0 -322
- package/es/ae/oracle.js.map +0 -1
- package/es/ae/universal.js +0 -45
- package/es/ae/universal.js.map +0 -1
- package/es/ae/wallet.js +0 -50
- package/es/ae/wallet.js.map +0 -1
- package/es/amount-formatter.d.ts +0 -58
- package/es/bignumber.d.ts +0 -24
- package/es/chain/index.js +0 -256
- package/es/chain/index.js.map +0 -1
- package/es/chain/node.js +0 -394
- package/es/chain/node.js.map +0 -1
- package/es/channel/handlers.js.map +0 -1
- package/es/channel/index.js +0 -980
- package/es/channel/index.js.map +0 -1
- package/es/channel/internal.js +0 -266
- package/es/channel/internal.js.map +0 -1
- package/es/contract/aci/helpers.js +0 -298
- package/es/contract/aci/helpers.js.map +0 -1
- package/es/contract/aci/index.js +0 -361
- package/es/contract/aci/index.js.map +0 -1
- package/es/contract/aci/transformation.js +0 -66
- package/es/contract/aci/transformation.js.map +0 -1
- package/es/contract/compiler.js +0 -244
- package/es/contract/compiler.js.map +0 -1
- package/es/contract/ga/helpers.js +0 -22
- package/es/contract/ga/helpers.js.map +0 -1
- package/es/contract/ga/index.js +0 -170
- package/es/contract/ga/index.js.map +0 -1
- package/es/contract/index.js +0 -162
- package/es/contract/index.js.map +0 -1
- package/es/crypto-ts.d.ts +0 -9
- package/es/index.js +0 -57
- package/es/index.js.map +0 -1
- package/es/node-pool/index.js +0 -187
- package/es/node-pool/index.js.map +0 -1
- package/es/node.js +0 -132
- package/es/node.js.map +0 -1
- package/es/other.d.ts +0 -31
- package/es/string.d.ts +0 -26
- package/es/tx/builder/helpers.js +0 -305
- package/es/tx/builder/helpers.js.map +0 -1
- package/es/tx/builder/index.js +0 -595
- package/es/tx/builder/index.js.map +0 -1
- package/es/tx/builder/schema.js +0 -814
- package/es/tx/builder/schema.js.map +0 -1
- package/es/tx/index.js +0 -300
- package/es/tx/index.js.map +0 -1
- package/es/tx/tx-object.js +0 -276
- package/es/tx/tx-object.js.map +0 -1
- package/es/tx/tx.js +0 -937
- package/es/tx/tx.js.map +0 -1
- package/es/tx/validator.js +0 -208
- package/es/tx/validator.js.map +0 -1
- package/es/typings/blakejs/index.d.js +0 -2
- package/es/typings/blakejs/index.d.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -131
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -184
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/index.js +0 -84
- package/es/utils/aepp-wallet-communication/connection/index.js.map +0 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.js +0 -97
- package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +0 -1
- package/es/utils/aepp-wallet-communication/helpers.js +0 -103
- package/es/utils/aepp-wallet-communication/helpers.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -329
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -270
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -533
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/schema.js +0 -107
- package/es/utils/aepp-wallet-communication/schema.js.map +0 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.js +0 -109
- package/es/utils/aepp-wallet-communication/wallet-detector.js.map +0 -1
- package/es/utils/amount-formatter.js.map +0 -1
- package/es/utils/async-init.js +0 -67
- package/es/utils/async-init.js.map +0 -1
- package/es/utils/bignumber.js +0 -28
- package/es/utils/bignumber.js.map +0 -1
- package/es/utils/bytes.js.map +0 -1
- package/es/utils/crypto-ts.js.map +0 -1
- package/es/utils/crypto.js +0 -304
- package/es/utils/crypto.js.map +0 -1
- package/es/utils/hd-wallet.js +0 -112
- package/es/utils/hd-wallet.js.map +0 -1
- package/es/utils/json-big.js +0 -45
- package/es/utils/json-big.js.map +0 -1
- package/es/utils/keystore.js +0 -228
- package/es/utils/keystore.js.map +0 -1
- package/es/utils/mptree.js.map +0 -1
- package/es/utils/other.js +0 -43
- package/es/utils/other.js.map +0 -1
- package/es/utils/semver-satisfies.js.map +0 -1
- package/es/utils/string.js.map +0 -1
- package/es/utils/swagger.js +0 -132
- package/es/utils/swagger.js.map +0 -1
- package/src/account/base.js +0 -153
- package/src/account/memory.js +0 -78
- package/src/account/multiple.js +0 -154
- package/src/ae/aens.js +0 -366
- package/src/ae/aepp.js +0 -45
- package/src/ae/contract.js +0 -285
- package/src/ae/index.js +0 -167
- package/src/ae/oracle.js +0 -296
- package/src/ae/universal.js +0 -47
- package/src/ae/wallet.js +0 -50
- package/src/chain/index.js +0 -250
- package/src/chain/node.js +0 -293
- package/src/channel/index.js +0 -898
- package/src/channel/internal.js +0 -231
- package/src/contract/aci/index.js +0 -317
- package/src/contract/aci/transformation.js +0 -72
- package/src/contract/compiler.js +0 -195
- package/src/contract/ga/helpers.js +0 -17
- package/src/contract/ga/index.js +0 -147
- package/src/contract/index.js +0 -163
- package/src/index.js +0 -90
- package/src/node-pool/index.js +0 -171
- package/src/node.js +0 -118
- package/src/tx/builder/helpers.js +0 -325
- package/src/tx/builder/index.js +0 -460
- package/src/tx/builder/schema.js +0 -1211
- package/src/tx/index.js +0 -301
- package/src/tx/tx-object.js +0 -186
- package/src/tx/tx.js +0 -622
- package/src/tx/validator.js +0 -161
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -114
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -161
- package/src/utils/aepp-wallet-communication/connection/index.js +0 -85
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +0 -85
- package/src/utils/aepp-wallet-communication/helpers.js +0 -70
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -268
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -223
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -390
- package/src/utils/aepp-wallet-communication/schema.js +0 -108
- package/src/utils/aepp-wallet-communication/wallet-detector.js +0 -91
- package/src/utils/async-init.js +0 -41
- package/src/utils/crypto.js +0 -312
- package/src/utils/hd-wallet.js +0 -115
- package/src/utils/json-big.js +0 -26
- package/src/utils/keystore.js +0 -223
- package/src/utils/swagger.js +0 -133
package/es/contract/index.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ISC License (ISC)
|
|
3
|
-
* Copyright (c) 2018 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
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Contract Base module
|
|
20
|
-
* @module @aeternity/aepp-sdk/es/contract
|
|
21
|
-
* @export Contract
|
|
22
|
-
* @example import ContractBase from '@aeternity/aepp-sdk/es/contract'
|
|
23
|
-
*/
|
|
24
|
-
import stampit from '@stamp/it';
|
|
25
|
-
import { required } from '@stamp/required';
|
|
26
|
-
/**
|
|
27
|
-
* Basic Contract Stamp
|
|
28
|
-
*
|
|
29
|
-
* This stamp include api call's related to contract functionality.
|
|
30
|
-
* Attempting to create instances from the Stamp without overwriting all
|
|
31
|
-
* abstract methods using composition will result in an exception.
|
|
32
|
-
* @function
|
|
33
|
-
* @alias module:@aeternity/aepp-sdk/es/contract
|
|
34
|
-
* @rtype Stamp
|
|
35
|
-
* @param {Object} [options={}] - Initializer object
|
|
36
|
-
* @return {Object} Contract instance
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
const ContractBase = stampit(required({
|
|
40
|
-
methods: {
|
|
41
|
-
contractEncodeCallDataAPI: required,
|
|
42
|
-
compileContractAPI: required,
|
|
43
|
-
contractGetACI: required,
|
|
44
|
-
setCompilerUrl: required,
|
|
45
|
-
getCompilerVersion: required,
|
|
46
|
-
contractDecodeCallResultAPI: required,
|
|
47
|
-
validateByteCodeAPI: required,
|
|
48
|
-
getFateAssembler: required,
|
|
49
|
-
getBytecodeCompilerVersion: required
|
|
50
|
-
}
|
|
51
|
-
}));
|
|
52
|
-
/**
|
|
53
|
-
* Get contract ACI
|
|
54
|
-
* @function contractGetACI
|
|
55
|
-
* @instance
|
|
56
|
-
* @abstract
|
|
57
|
-
* @category async
|
|
58
|
-
* @rtype (source: String, options: Array) => aciObject: Promise[Object]
|
|
59
|
-
* @param {String} source - Contract source code
|
|
60
|
-
* @param {Object} [options={}] Options
|
|
61
|
-
* @param {Object} [options.filesystem] Contract external namespaces map
|
|
62
|
-
* @return {Object} - Contract aci object
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Encode contract data
|
|
67
|
-
* @function contractEncodeCallDataAPI
|
|
68
|
-
* @instance
|
|
69
|
-
* @abstract
|
|
70
|
-
* @category async
|
|
71
|
-
* @rtype (source: String, name: String, args: Array, options: Array) => callData: Promise[String]
|
|
72
|
-
* @param {String} source - Contract source code
|
|
73
|
-
* @param {String} name - Function name
|
|
74
|
-
* @param {Array} args - Function argument's
|
|
75
|
-
* @param {Object} [options={}] Options
|
|
76
|
-
* @param {Object} [options.filesystem] Contract external namespaces map
|
|
77
|
-
* @return {String} - Contract encoded data
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Decode contract call result data
|
|
82
|
-
* @function contractDecodeCallResultAPI
|
|
83
|
-
* @instance
|
|
84
|
-
* @abstract
|
|
85
|
-
* @category async
|
|
86
|
-
* @rtype (
|
|
87
|
-
* source: String, fn: String, callValue: String, callResult: String, options: Array
|
|
88
|
-
* ) => decodedResult: Promise[String]
|
|
89
|
-
* @param {String} source - Contract source
|
|
90
|
-
* @param {String} fn - Fn name
|
|
91
|
-
* @param {String} callValue - result data (cb_das...)
|
|
92
|
-
* @param {String} callResult - contract call result status('ok', 'revert', ...)
|
|
93
|
-
* @param {Object} [options={}] Options
|
|
94
|
-
* @param {Object} [options.filesystem] Contract external namespaces map
|
|
95
|
-
* @return {String} - Decoded contract call result
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Decode call data by source
|
|
100
|
-
* @function contractDecodeCallDataBySourceAPI
|
|
101
|
-
* @instance
|
|
102
|
-
* @abstract
|
|
103
|
-
* @category async
|
|
104
|
-
* @rtype (
|
|
105
|
-
* source: String, function: String, callData: String, options: Array
|
|
106
|
-
* ) => decodedResult: Promise[String]
|
|
107
|
-
* @param {String} source - contract source
|
|
108
|
-
* @param {String} function - function name
|
|
109
|
-
* @param {String} callData - Encoded contract call data
|
|
110
|
-
* @param {Object} [options={}] Options
|
|
111
|
-
* @param {Object} [options.filesystem] Contract external namespaces map
|
|
112
|
-
* @return {String} - Decoded contract call data
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Decode call data by bytecode
|
|
117
|
-
* @function contractDecodeCallDataByCodeAPI
|
|
118
|
-
* @instance
|
|
119
|
-
* @abstract
|
|
120
|
-
* @category async
|
|
121
|
-
* @rtype (code: String, callData: String) => decodedResult: Promise[String]
|
|
122
|
-
* @param {String} code - contract byte code
|
|
123
|
-
* @param {String} callData - Encoded contract call data
|
|
124
|
-
* @return {String} - Decoded contract call data
|
|
125
|
-
*/
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Compile contract
|
|
129
|
-
* @function compileContractAPI
|
|
130
|
-
* @instance
|
|
131
|
-
* @abstract
|
|
132
|
-
* @category async
|
|
133
|
-
* @rtype (code: String, options?: Object) => compiledContract: Object
|
|
134
|
-
* @param {String} code - Contract source code
|
|
135
|
-
* @param {Object} [options={}] Options
|
|
136
|
-
* @param {Object} [options.filesystem] Contract external namespaces map
|
|
137
|
-
* @return {Object} Object which contain bytecode of contract
|
|
138
|
-
*/
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Set compiler url
|
|
142
|
-
* @function setCompilerUrl
|
|
143
|
-
* @instance
|
|
144
|
-
* @abstract
|
|
145
|
-
* @category async
|
|
146
|
-
* @rtype (url: String) => void
|
|
147
|
-
* @param {String} url - Compiler url
|
|
148
|
-
* @return {void}
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Get Compiler Version
|
|
153
|
-
* @function getCompilerVersion
|
|
154
|
-
* @instance
|
|
155
|
-
* @abstract
|
|
156
|
-
* @category async
|
|
157
|
-
* @rtype () => String
|
|
158
|
-
* @return {String} Compiler version
|
|
159
|
-
*/
|
|
160
|
-
|
|
161
|
-
export default ContractBase;
|
|
162
|
-
//# sourceMappingURL=index.js.map
|
package/es/contract/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contract/index.js"],"names":["stampit","required","ContractBase","methods","contractEncodeCallDataAPI","compileContractAPI","contractGetACI","setCompilerUrl","getCompilerVersion","contractDecodeCallResultAPI","validateByteCodeAPI","getFateAssembler","getBytecodeCompilerVersion"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAOA,OAAP,MAAoB,WAApB;AACA,SAASC,QAAT,QAAyB,iBAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,YAAY,GAAGF,OAAO,CAACC,QAAQ,CAAC;AACpCE,EAAAA,OAAO,EAAE;AACPC,IAAAA,yBAAyB,EAAEH,QADpB;AAEPI,IAAAA,kBAAkB,EAAEJ,QAFb;AAGPK,IAAAA,cAAc,EAAEL,QAHT;AAIPM,IAAAA,cAAc,EAAEN,QAJT;AAKPO,IAAAA,kBAAkB,EAAEP,QALb;AAMPQ,IAAAA,2BAA2B,EAAER,QANtB;AAOPS,IAAAA,mBAAmB,EAAET,QAPd;AAQPU,IAAAA,gBAAgB,EAAEV,QARX;AASPW,IAAAA,0BAA0B,EAAEX;AATrB;AAD2B,CAAD,CAAT,CAA5B;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAeC,YAAf","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2018 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 * Contract Base module\n * @module @aeternity/aepp-sdk/es/contract\n * @export Contract\n * @example import ContractBase from '@aeternity/aepp-sdk/es/contract'\n */\n\nimport stampit from '@stamp/it'\nimport { required } from '@stamp/required'\n\n/**\n * Basic Contract Stamp\n *\n * This stamp include api call's related to contract functionality.\n * Attempting to create instances from the Stamp without overwriting all\n * abstract methods using composition will result in an exception.\n * @function\n * @alias module:@aeternity/aepp-sdk/es/contract\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @return {Object} Contract instance\n */\nconst ContractBase = stampit(required({\n methods: {\n contractEncodeCallDataAPI: required,\n compileContractAPI: required,\n contractGetACI: required,\n setCompilerUrl: required,\n getCompilerVersion: required,\n contractDecodeCallResultAPI: required,\n validateByteCodeAPI: required,\n getFateAssembler: required,\n getBytecodeCompilerVersion: required\n }\n}))\n\n/**\n * Get contract ACI\n * @function contractGetACI\n * @instance\n * @abstract\n * @category async\n * @rtype (source: String, options: Array) => aciObject: Promise[Object]\n * @param {String} source - Contract source code\n * @param {Object} [options={}] Options\n * @param {Object} [options.filesystem] Contract external namespaces map\n * @return {Object} - Contract aci object\n */\n\n/**\n * Encode contract data\n * @function contractEncodeCallDataAPI\n * @instance\n * @abstract\n * @category async\n * @rtype (source: String, name: String, args: Array, options: Array) => callData: Promise[String]\n * @param {String} source - Contract source code\n * @param {String} name - Function name\n * @param {Array} args - Function argument's\n * @param {Object} [options={}] Options\n * @param {Object} [options.filesystem] Contract external namespaces map\n * @return {String} - Contract encoded data\n */\n\n/**\n * Decode contract call result data\n * @function contractDecodeCallResultAPI\n * @instance\n * @abstract\n * @category async\n * @rtype (\n * source: String, fn: String, callValue: String, callResult: String, options: Array\n * ) => decodedResult: Promise[String]\n * @param {String} source - Contract source\n * @param {String} fn - Fn name\n * @param {String} callValue - result data (cb_das...)\n * @param {String} callResult - contract call result status('ok', 'revert', ...)\n * @param {Object} [options={}] Options\n * @param {Object} [options.filesystem] Contract external namespaces map\n * @return {String} - Decoded contract call result\n */\n\n/**\n * Decode call data by source\n * @function contractDecodeCallDataBySourceAPI\n * @instance\n * @abstract\n * @category async\n * @rtype (\n * source: String, function: String, callData: String, options: Array\n * ) => decodedResult: Promise[String]\n * @param {String} source - contract source\n * @param {String} function - function name\n * @param {String} callData - Encoded contract call data\n * @param {Object} [options={}] Options\n * @param {Object} [options.filesystem] Contract external namespaces map\n * @return {String} - Decoded contract call data\n */\n\n/**\n * Decode call data by bytecode\n * @function contractDecodeCallDataByCodeAPI\n * @instance\n * @abstract\n * @category async\n * @rtype (code: String, callData: String) => decodedResult: Promise[String]\n * @param {String} code - contract byte code\n * @param {String} callData - Encoded contract call data\n * @return {String} - Decoded contract call data\n */\n\n/**\n * Compile contract\n * @function compileContractAPI\n * @instance\n * @abstract\n * @category async\n * @rtype (code: String, options?: Object) => compiledContract: Object\n * @param {String} code - Contract source code\n * @param {Object} [options={}] Options\n * @param {Object} [options.filesystem] Contract external namespaces map\n * @return {Object} Object which contain bytecode of contract\n */\n\n/**\n * Set compiler url\n * @function setCompilerUrl\n * @instance\n * @abstract\n * @category async\n * @rtype (url: String) => void\n * @param {String} url - Compiler url\n * @return {void}\n */\n\n/**\n * Get Compiler Version\n * @function getCompilerVersion\n * @instance\n * @abstract\n * @category async\n * @rtype () => String\n * @return {String} Compiler version\n */\n\nexport default ContractBase\n"],"file":"index.js"}
|
package/es/crypto-ts.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { Data } from 'blakejs';
|
|
3
|
-
/**
|
|
4
|
-
* Calculate 256bits Blake2b hash of `input`
|
|
5
|
-
* @rtype (input: String) => hash: String
|
|
6
|
-
* @param {Data} input - Data to hash
|
|
7
|
-
* @return {Buffer} Hash
|
|
8
|
-
*/
|
|
9
|
-
export declare function hash(input: Data): Buffer;
|
package/es/index.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ISC License (ISC)
|
|
3
|
-
* Copyright (c) 2018 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
|
-
import * as Crypto from './utils/crypto';
|
|
18
|
-
import * as Keystore from './utils/keystore';
|
|
19
|
-
import * as Bytes from './utils/bytes';
|
|
20
|
-
import * as TxBuilder from './tx/builder';
|
|
21
|
-
import * as TxBuilderHelper from './tx/builder/helpers';
|
|
22
|
-
import * as SCHEMA from './tx/builder/schema';
|
|
23
|
-
import * as ACITransformation from './contract/aci/transformation';
|
|
24
|
-
import * as AmountFormatter from './utils/amount-formatter';
|
|
25
|
-
import HdWallet from './utils/hd-wallet';
|
|
26
|
-
import Ae from './ae';
|
|
27
|
-
import Chain from './chain';
|
|
28
|
-
import ChainNode from './chain/node';
|
|
29
|
-
import Node from './node';
|
|
30
|
-
import NodePool from './node-pool';
|
|
31
|
-
import Tx from './tx';
|
|
32
|
-
import Transaction from './tx/tx';
|
|
33
|
-
import verifyTransaction from './tx/validator';
|
|
34
|
-
import AccountBase from './account/base';
|
|
35
|
-
import AccountMultiple from './account/multiple';
|
|
36
|
-
import MemoryAccount from './account/memory';
|
|
37
|
-
import Aens from './ae/aens';
|
|
38
|
-
import Contract from './ae/contract';
|
|
39
|
-
import GeneralizeAccount from './contract/ga';
|
|
40
|
-
import ContractCompilerAPI from './contract/compiler';
|
|
41
|
-
import RpcAepp from './ae/aepp';
|
|
42
|
-
import RpcWallet from './ae/wallet';
|
|
43
|
-
import Oracle from './ae/oracle';
|
|
44
|
-
import genSwaggerClient from './utils/swagger';
|
|
45
|
-
import Channel from './channel';
|
|
46
|
-
import Universal from './ae/universal';
|
|
47
|
-
export { default as ContentScriptBridge } from './utils/aepp-wallet-communication/content-script-bridge';
|
|
48
|
-
import * as _AeppWalletHelpers from './utils/aepp-wallet-communication/helpers';
|
|
49
|
-
export { _AeppWalletHelpers as AeppWalletHelpers };
|
|
50
|
-
import * as _AeppWalletSchema from './utils/aepp-wallet-communication/schema';
|
|
51
|
-
export { _AeppWalletSchema as AeppWalletSchema };
|
|
52
|
-
export { default as WalletDetector } from './utils/aepp-wallet-communication/wallet-detector';
|
|
53
|
-
export { default as BrowserRuntimeConnection } from './utils/aepp-wallet-communication/connection/browser-runtime';
|
|
54
|
-
export { default as BrowserWindowMessageConnection } from './utils/aepp-wallet-communication/connection/browser-window-message';
|
|
55
|
-
export const getDefaultPointerKey = TxBuilderHelper.getDefaultPointerKey;
|
|
56
|
-
export { AmountFormatter, AccountBase, AccountMultiple, Ae, Aens, Bytes, Contract, ContractCompilerAPI, ACITransformation, ChainNode, RpcAepp, RpcWallet, Channel, Crypto, Keystore, Chain, GeneralizeAccount, HdWallet, MemoryAccount, Node, NodePool, Oracle, genSwaggerClient, Transaction, verifyTransaction, Tx, TxBuilder, TxBuilderHelper, Universal, SCHEMA };
|
|
57
|
-
//# sourceMappingURL=index.js.map
|
package/es/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["Crypto","Keystore","Bytes","TxBuilder","TxBuilderHelper","SCHEMA","ACITransformation","AmountFormatter","HdWallet","Ae","Chain","ChainNode","Node","NodePool","Tx","Transaction","verifyTransaction","AccountBase","AccountMultiple","MemoryAccount","Aens","Contract","GeneralizeAccount","ContractCompilerAPI","RpcAepp","RpcWallet","Oracle","genSwaggerClient","Channel","Universal","default","ContentScriptBridge","AeppWalletHelpers","AeppWalletSchema","WalletDetector","BrowserRuntimeConnection","BrowserWindowMessageConnection","getDefaultPointerKey"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,MAAZ,MAAwB,gBAAxB;AACA,OAAO,KAAKC,QAAZ,MAA0B,kBAA1B;AACA,OAAO,KAAKC,KAAZ,MAAuB,eAAvB;AACA,OAAO,KAAKC,SAAZ,MAA2B,cAA3B;AACA,OAAO,KAAKC,eAAZ,MAAiC,sBAAjC;AACA,OAAO,KAAKC,MAAZ,MAAwB,qBAAxB;AACA,OAAO,KAAKC,iBAAZ,MAAmC,+BAAnC;AACA,OAAO,KAAKC,eAAZ,MAAiC,0BAAjC;AACA,OAAOC,QAAP,MAAqB,mBAArB;AAEA,OAAOC,EAAP,MAAe,MAAf;AACA,OAAOC,KAAP,MAAkB,SAAlB;AACA,OAAOC,SAAP,MAAsB,cAAtB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,OAAOC,EAAP,MAAe,MAAf;AACA,OAAOC,WAAP,MAAwB,SAAxB;AACA,OAAOC,iBAAP,MAA8B,gBAA9B;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,OAAOC,IAAP,MAAiB,WAAjB;AACA,OAAOC,QAAP,MAAqB,eAArB;AACA,OAAOC,iBAAP,MAA8B,eAA9B;AACA,OAAOC,mBAAP,MAAgC,qBAAhC;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,OAAOC,MAAP,MAAmB,aAAnB;AACA,OAAOC,gBAAP,MAA6B,iBAA7B;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAOC,SAAP,MAAsB,gBAAtB;AAEA,SAASC,OAAO,IAAIC,mBAApB,QAA+C,yDAA/C;oCACmC,2C;+BAAvBC,iB;mCACsB,0C;8BAAtBC,gB;AACZ,SAASH,OAAO,IAAII,cAApB,QAA0C,mDAA1C;AACA,SAASJ,OAAO,IAAIK,wBAApB,QAAoD,8DAApD;AACA,SAASL,OAAO,IAAIM,8BAApB,QAA0D,qEAA1D;AAEA,OAAO,MAAMC,oBAAoB,GAAGjC,eAAe,CAACiC,oBAA7C;AAEP,SACE9B,eADF,EAEEU,WAFF,EAGEC,eAHF,EAIET,EAJF,EAKEW,IALF,EAMElB,KANF,EAOEmB,QAPF,EAQEE,mBARF,EASEjB,iBATF,EAUEK,SAVF,EAWEa,OAXF,EAYEC,SAZF,EAaEG,OAbF,EAcE5B,MAdF,EAeEC,QAfF,EAgBES,KAhBF,EAiBEY,iBAjBF,EAkBEd,QAlBF,EAmBEW,aAnBF,EAoBEP,IApBF,EAqBEC,QArBF,EAsBEa,MAtBF,EAuBEC,gBAvBF,EAwBEZ,WAxBF,EAyBEC,iBAzBF,EA0BEF,EA1BF,EA2BEX,SA3BF,EA4BEC,eA5BF,EA6BEyB,SA7BF,EA8BExB,MA9BF","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2018 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\nimport * as Crypto from './utils/crypto'\nimport * as Keystore from './utils/keystore'\nimport * as Bytes from './utils/bytes'\nimport * as TxBuilder from './tx/builder'\nimport * as TxBuilderHelper from './tx/builder/helpers'\nimport * as SCHEMA from './tx/builder/schema'\nimport * as ACITransformation from './contract/aci/transformation'\nimport * as AmountFormatter from './utils/amount-formatter'\nimport HdWallet from './utils/hd-wallet'\n\nimport Ae from './ae'\nimport Chain from './chain'\nimport ChainNode from './chain/node'\nimport Node from './node'\nimport NodePool from './node-pool'\nimport Tx from './tx'\nimport Transaction from './tx/tx'\nimport verifyTransaction from './tx/validator'\nimport AccountBase from './account/base'\nimport AccountMultiple from './account/multiple'\nimport MemoryAccount from './account/memory'\nimport Aens from './ae/aens'\nimport Contract from './ae/contract'\nimport GeneralizeAccount from './contract/ga'\nimport ContractCompilerAPI from './contract/compiler'\nimport RpcAepp from './ae/aepp'\nimport RpcWallet from './ae/wallet'\nimport Oracle from './ae/oracle'\nimport genSwaggerClient from './utils/swagger'\nimport Channel from './channel'\nimport Universal from './ae/universal'\n\nexport { default as ContentScriptBridge } from './utils/aepp-wallet-communication/content-script-bridge'\nexport * as AeppWalletHelpers from './utils/aepp-wallet-communication/helpers'\nexport * as AeppWalletSchema from './utils/aepp-wallet-communication/schema'\nexport { default as WalletDetector } from './utils/aepp-wallet-communication/wallet-detector'\nexport { default as BrowserRuntimeConnection } from './utils/aepp-wallet-communication/connection/browser-runtime'\nexport { default as BrowserWindowMessageConnection } from './utils/aepp-wallet-communication/connection/browser-window-message'\n\nexport const getDefaultPointerKey = TxBuilderHelper.getDefaultPointerKey\n\nexport {\n AmountFormatter,\n AccountBase,\n AccountMultiple,\n Ae,\n Aens,\n Bytes,\n Contract,\n ContractCompilerAPI,\n ACITransformation,\n ChainNode,\n RpcAepp,\n RpcWallet,\n Channel,\n Crypto,\n Keystore,\n Chain,\n GeneralizeAccount,\n HdWallet,\n MemoryAccount,\n Node,\n NodePool,\n Oracle,\n genSwaggerClient,\n Transaction,\n verifyTransaction,\n Tx,\n TxBuilder,\n TxBuilderHelper,\n Universal,\n SCHEMA\n}\n"],"file":"index.js"}
|
package/es/node-pool/index.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NodePool module
|
|
3
|
-
* @module @aeternity/aepp-sdk/es/node-pool
|
|
4
|
-
* @export NodePool
|
|
5
|
-
* @example import { NodePool } from '@aeternity/aepp-sdk'
|
|
6
|
-
*/
|
|
7
|
-
import stampit from '@stamp/it';
|
|
8
|
-
import { getNetworkId } from '../node';
|
|
9
|
-
/**
|
|
10
|
-
* Node Pool Stamp
|
|
11
|
-
* This stamp allow you to make basic manipulation(add, remove, select) on list of nodes
|
|
12
|
-
* @function
|
|
13
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
14
|
-
* @rtype Stamp
|
|
15
|
-
* @param {Object} [options={}] - Initializer object
|
|
16
|
-
* @param {Array} [options.nodes] - Array with Node instances
|
|
17
|
-
* @return {Object} NodePool instance
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export default stampit({
|
|
21
|
-
init() {
|
|
22
|
-
let {
|
|
23
|
-
nodes = []
|
|
24
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
25
|
-
this.pool = new Map();
|
|
26
|
-
this.validateNodes(nodes);
|
|
27
|
-
nodes.forEach((node, i) => {
|
|
28
|
-
const {
|
|
29
|
-
name,
|
|
30
|
-
instance
|
|
31
|
-
} = node;
|
|
32
|
-
this.addNode(name, instance, i === 0);
|
|
33
|
-
});
|
|
34
|
-
if (nodes.length) this.selectNode(nodes[0].name);
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
propertyDescriptors: {
|
|
38
|
-
api: {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: false,
|
|
41
|
-
|
|
42
|
-
get() {
|
|
43
|
-
if (!this.selectedNode || !this.selectedNode.instance) {
|
|
44
|
-
throw new Error('You can\'t use Node API. Node is not connected or not defined!');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return this.selectedNode.instance.api;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
methods: {
|
|
53
|
-
/**
|
|
54
|
-
* Add Node
|
|
55
|
-
* @function
|
|
56
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
57
|
-
* @rtype (name: String, nodeInstance: Object, select: Boolean) => void
|
|
58
|
-
* @param {String} name - Node name
|
|
59
|
-
* @param {Object} node - Node instance
|
|
60
|
-
* @param {Boolean} select - Select this node as current
|
|
61
|
-
* @return {void}
|
|
62
|
-
* @example
|
|
63
|
-
* // add and select new node with name 'testNode'
|
|
64
|
-
* nodePool.addNode('testNode', awaitNode({ url, internalUrl }), true)
|
|
65
|
-
*/
|
|
66
|
-
addNode(name, node) {
|
|
67
|
-
let select = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
68
|
-
if (this.pool.has(name)) throw new Error(`Node with name ${name} already exist`);
|
|
69
|
-
this.validateNodes([{
|
|
70
|
-
name,
|
|
71
|
-
instance: node
|
|
72
|
-
}]);
|
|
73
|
-
this.pool.set(name, {
|
|
74
|
-
name,
|
|
75
|
-
instance: node,
|
|
76
|
-
url: node.url,
|
|
77
|
-
internalUrl: node.internalUrl,
|
|
78
|
-
networkId: node.nodeNetworkId,
|
|
79
|
-
version: node.version,
|
|
80
|
-
consensusProtocolVersion: node.consensusProtocolVersion
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
if (select || !this.selectedNode) {
|
|
84
|
-
this.selectNode(name);
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Select Node
|
|
90
|
-
* @function
|
|
91
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
92
|
-
* @rtype (name: String) => void
|
|
93
|
-
* @param {String} name - Node name
|
|
94
|
-
* @return {void}
|
|
95
|
-
* @example
|
|
96
|
-
* nodePool.selectNode('testNode')
|
|
97
|
-
*/
|
|
98
|
-
selectNode(name) {
|
|
99
|
-
if (!this.pool.has(name)) throw new Error(`Node with name ${name} not in pool`);
|
|
100
|
-
this.selectedNode = this.pool.get(name);
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Get NetworkId of current Node
|
|
105
|
-
* @function
|
|
106
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
107
|
-
* @rtype () => String
|
|
108
|
-
* @return {String}
|
|
109
|
-
* @example
|
|
110
|
-
* nodePool.getNetworkId()
|
|
111
|
-
*/
|
|
112
|
-
getNetworkId,
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Check if you have selected node
|
|
116
|
-
* @function
|
|
117
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
118
|
-
* @rtype () => Boolean
|
|
119
|
-
* @return {Boolean}
|
|
120
|
-
* @example
|
|
121
|
-
* nodePool.isNodeConnected()
|
|
122
|
-
*/
|
|
123
|
-
isNodeConnected() {
|
|
124
|
-
return !!this.selectedNode.instance;
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Get information about node
|
|
129
|
-
* @function
|
|
130
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
131
|
-
* @rtype () => Object
|
|
132
|
-
* @return {Object}
|
|
133
|
-
* @example
|
|
134
|
-
* nodePool.getNodeInfo() // { name, version, networkId, protocol, ... }
|
|
135
|
-
*/
|
|
136
|
-
getNodeInfo() {
|
|
137
|
-
if (!this.isNodeConnected()) throw new Error('Can not get node info. Node is not connected');
|
|
138
|
-
return {
|
|
139
|
-
name: this.selectedNode.name,
|
|
140
|
-
...this.selectedNode.instance.getNodeInfo()
|
|
141
|
-
};
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Get array of available nodes
|
|
146
|
-
* @function
|
|
147
|
-
* @alias module:@aeternity/aepp-sdk/es/node-pool
|
|
148
|
-
* @rtype () => Object[]
|
|
149
|
-
* @return {Object[]}
|
|
150
|
-
* @example
|
|
151
|
-
* nodePool.getNodesInPool()
|
|
152
|
-
*/
|
|
153
|
-
getNodesInPool() {
|
|
154
|
-
return Array.from(this.pool.entries()).map(_ref => {
|
|
155
|
-
let [name, node] = _ref;
|
|
156
|
-
return {
|
|
157
|
-
name,
|
|
158
|
-
...node.instance.getNodeInfo()
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
validateNodes(nodes) {
|
|
164
|
-
// TODO: validate it on TypeScript level instead
|
|
165
|
-
// (to speedup development, save runtime resources)
|
|
166
|
-
if (!Array.isArray(nodes)) throw new Error('"nodes" should be an array');
|
|
167
|
-
const notObject = nodes.map(n => typeof n).find(t => t !== 'object');
|
|
168
|
-
if (notObject) throw new Error(`Each node should be an object, got ${notObject} instead`);
|
|
169
|
-
const wrongFields = nodes.find(n => typeof n.name !== 'string' || typeof n.instance !== 'object');
|
|
170
|
-
|
|
171
|
-
if (notObject) {
|
|
172
|
-
throw new Error('Each node should have name (string), instance (object) ' + `fields, got ${JSON.stringify(wrongFields)} instead`);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const wrongInstanceFields = nodes.map(n => n.instance).find(i => typeof i.api !== 'object' || typeof i.genesisHash !== 'string' || typeof i.consensusProtocolVersion !== 'number');
|
|
176
|
-
|
|
177
|
-
if (wrongInstanceFields) {
|
|
178
|
-
throw new Error('Each node instance should have api (object), consensusProtocolVersion (number), ' + `genesisHash (string) fields, got ${JSON.stringify(wrongInstanceFields)} instead`);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
},
|
|
183
|
-
props: {
|
|
184
|
-
selectedNode: {}
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/node-pool/index.js"],"names":["stampit","getNetworkId","init","nodes","pool","Map","validateNodes","forEach","node","i","name","instance","addNode","length","selectNode","propertyDescriptors","api","enumerable","configurable","get","selectedNode","Error","methods","select","has","set","url","internalUrl","networkId","nodeNetworkId","version","consensusProtocolVersion","isNodeConnected","getNodeInfo","getNodesInPool","Array","from","entries","map","isArray","notObject","n","find","t","wrongFields","JSON","stringify","wrongInstanceFields","genesisHash","props"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,OAAP,MAAoB,WAApB;AACA,SAASC,YAAT,QAA6B,SAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeD,OAAO,CAAC;AACrBE,EAAAA,IAAI,GAAuB;AAAA,QAArB;AAAEC,MAAAA,KAAK,GAAG;AAAV,KAAqB,uEAAJ,EAAI;AACzB,SAAKC,IAAL,GAAY,IAAIC,GAAJ,EAAZ;AACA,SAAKC,aAAL,CAAmBH,KAAnB;AAEAA,IAAAA,KAAK,CAACI,OAAN,CAAc,CAACC,IAAD,EAAOC,CAAP,KAAa;AACzB,YAAM;AAAEC,QAAAA,IAAF;AAAQC,QAAAA;AAAR,UAAqBH,IAA3B;AACA,WAAKI,OAAL,CAAaF,IAAb,EAAmBC,QAAnB,EAA6BF,CAAC,KAAK,CAAnC;AACD,KAHD;AAIA,QAAIN,KAAK,CAACU,MAAV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@module @aeternity/aepp-sdk/es/node-pool\n * @export NodePool\n * @example import { NodePool } from '@aeternity/aepp-sdk'\n */\nimport stampit from '@stamp/it'\nimport { getNetworkId } from '../node'\n\n/**\n * Node Pool Stamp\n * This stamp allow you to make basic manipulation(add, remove, select) on list of nodes\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @param {Array} [options.nodes] - Array with Node instances\n * @return {Object} NodePool instance\n */\nexport default stampit({\n init ({ nodes = [] } = {}) {\n this.pool = new Map()\n this.validateNodes(nodes)\n\n nodes.forEach((node, i) => {\n const { name, instance } = node\n this.addNode(name, instance, i === 0)\n })\n if (nodes.length) this.selectNode(nodes[0].name)\n },\n propertyDescriptors: {\n api: {\n enumerable: true,\n configurable: false,\n get () {\n if (!this.selectedNode || !this.selectedNode.instance) {\n throw new Error('You can\\'t use Node API. Node is not connected or not defined!')\n }\n return this.selectedNode.instance.api\n }\n }\n },\n methods: {\n /**\n * Add Node\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype (name: String, nodeInstance: Object, select: Boolean) => void\n * @param {String} name - Node name\n * @param {Object} node - Node instance\n * @param {Boolean} select - Select this node as current\n * @return {void}\n * @example\n * // add and select new node with name 'testNode'\n * nodePool.addNode('testNode', awaitNode({ url, internalUrl }), true)\n */\n addNode (name, node, select = false) {\n if (this.pool.has(name)) throw new Error(`Node with name ${name} already exist`)\n\n this.validateNodes([{ name, instance: node }])\n\n this.pool.set(name, {\n name,\n instance: node,\n url: node.url,\n internalUrl: node.internalUrl,\n networkId: node.nodeNetworkId,\n version: node.version,\n consensusProtocolVersion: node.consensusProtocolVersion\n })\n if (select || !this.selectedNode) {\n this.selectNode(name)\n }\n },\n /**\n * Select Node\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype (name: String) => void\n * @param {String} name - Node name\n * @return {void}\n * @example\n * nodePool.selectNode('testNode')\n */\n selectNode (name) {\n if (!this.pool.has(name)) throw new Error(`Node with name ${name} not in pool`)\n\n this.selectedNode = this.pool.get(name)\n },\n /**\n * Get NetworkId of current Node\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype () => String\n * @return {String}\n * @example\n * nodePool.getNetworkId()\n */\n getNetworkId,\n /**\n * Check if you have selected node\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype () => Boolean\n * @return {Boolean}\n * @example\n * nodePool.isNodeConnected()\n */\n isNodeConnected () {\n return !!this.selectedNode.instance\n },\n /**\n * Get information about node\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype () => Object\n * @return {Object}\n * @example\n * nodePool.getNodeInfo() // { name, version, networkId, protocol, ... }\n */\n getNodeInfo () {\n if (!this.isNodeConnected()) throw new Error('Can not get node info. Node is not connected')\n return {\n name: this.selectedNode.name,\n ...this.selectedNode.instance.getNodeInfo()\n }\n },\n /**\n * Get array of available nodes\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node-pool\n * @rtype () => Object[]\n * @return {Object[]}\n * @example\n * nodePool.getNodesInPool()\n */\n getNodesInPool () {\n return Array.from(this.pool.entries()).map(([name, node]) => ({\n name,\n ...node.instance.getNodeInfo()\n }))\n },\n validateNodes (nodes) {\n // TODO: validate it on TypeScript level instead\n // (to speedup development, save runtime resources)\n if (!Array.isArray(nodes)) throw new Error('\"nodes\" should be an array')\n const notObject = nodes.map(n => typeof n).find(t => t !== 'object')\n if (notObject) throw new Error(`Each node should be an object, got ${notObject} instead`)\n const wrongFields = nodes.find(n => typeof n.name !== 'string' || typeof n.instance !== 'object')\n if (notObject) {\n throw new Error(\n 'Each node should have name (string), instance (object) ' +\n `fields, got ${JSON.stringify(wrongFields)} instead`\n )\n }\n const wrongInstanceFields = nodes\n .map(n => n.instance)\n .find(i => typeof i.api !== 'object' || typeof i.genesisHash !== 'string' ||\n typeof i.consensusProtocolVersion !== 'number')\n if (wrongInstanceFields) {\n throw new Error(\n 'Each node instance should have api (object), consensusProtocolVersion (number), ' +\n `genesisHash (string) fields, got ${JSON.stringify(wrongInstanceFields)} instead`\n )\n }\n }\n },\n props: {\n selectedNode: {}\n }\n})\n"],"file":"index.js"}
|
package/es/node.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ISC License (ISC)
|
|
3
|
-
* Copyright (c) 2021 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
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Node module
|
|
20
|
-
* @module @aeternity/aepp-sdk/es/node
|
|
21
|
-
* @export Node
|
|
22
|
-
* @example import { Node } from '@aeternity/aepp-sdk'
|
|
23
|
-
*/
|
|
24
|
-
import AsyncInit from './utils/async-init';
|
|
25
|
-
import genSwaggerClient from './utils/swagger';
|
|
26
|
-
import semverSatisfies from './utils/semver-satisfies';
|
|
27
|
-
/**
|
|
28
|
-
* Obtain networkId from account or node
|
|
29
|
-
* @instance
|
|
30
|
-
* @category async
|
|
31
|
-
* @rtype () => networkId: String
|
|
32
|
-
* @return {String} NetworkId
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
export function getNetworkId() {
|
|
36
|
-
var _this$selectedNode;
|
|
37
|
-
|
|
38
|
-
let {
|
|
39
|
-
networkId,
|
|
40
|
-
force = false
|
|
41
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
42
|
-
const res = networkId || this.networkId || ((_this$selectedNode = this.selectedNode) === null || _this$selectedNode === void 0 ? void 0 : _this$selectedNode.networkId);
|
|
43
|
-
if (!force && !res) throw new Error('networkId is not provided');
|
|
44
|
-
if (force && !res) return null;
|
|
45
|
-
return res;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* {@link genSwaggerClient} based Node remote API Stamp
|
|
49
|
-
* @function
|
|
50
|
-
* @alias module:@aeternity/aepp-sdk/es/node
|
|
51
|
-
* @rtype Stamp
|
|
52
|
-
* @param {Object} [options={}] - Options
|
|
53
|
-
* @param {String} options.url - Base URL for Node
|
|
54
|
-
* @param {String} options.internalUrl - Base URL for internal requests
|
|
55
|
-
* @param {Object} options.axiosConfig - Object with axios configuration
|
|
56
|
-
* @param {Object} options.axiosConfig.config
|
|
57
|
-
* @param {Function} options.axiosConfig.errorHandler - (err) => throw err
|
|
58
|
-
* @return {Object} Node client
|
|
59
|
-
* @example Node({url: 'https://testnet.aeternity.io'})
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
const Node = AsyncInit.compose({
|
|
63
|
-
async init(_ref) {
|
|
64
|
-
let {
|
|
65
|
-
url,
|
|
66
|
-
internalUrl,
|
|
67
|
-
ignoreVersion
|
|
68
|
-
} = _ref;
|
|
69
|
-
if (!url) throw new Error('"url" required');
|
|
70
|
-
this.url = url.replace(/\/$/, '');
|
|
71
|
-
this.internalUrl = internalUrl ? internalUrl.replace(/\/$/, '') : this.url;
|
|
72
|
-
const client = await genSwaggerClient(`${this.url}/api?oas3`, {
|
|
73
|
-
internalUrl: this.internalUrl,
|
|
74
|
-
responseInterceptor: response => {
|
|
75
|
-
if (response.ok) return;
|
|
76
|
-
return Object.assign(response, {
|
|
77
|
-
statusText: `${new URL(response.url).pathname.slice(1)} error: ` + response.body.reason
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
this.version = client.spec.info.version;
|
|
82
|
-
|
|
83
|
-
if (!semverSatisfies(this.version, NODE_GE_VERSION, NODE_LT_VERSION) && !ignoreVersion) {
|
|
84
|
-
throw new Error(`Unsupported node version ${this.version}. ` + `Supported: >= ${NODE_GE_VERSION} < ${NODE_LT_VERSION}`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
this.api = client.api;
|
|
88
|
-
const {
|
|
89
|
-
nodeRevision: revision,
|
|
90
|
-
genesisKeyBlockHash: genesisHash,
|
|
91
|
-
networkId,
|
|
92
|
-
protocols,
|
|
93
|
-
topBlockHeight
|
|
94
|
-
} = await this.api.getStatus();
|
|
95
|
-
this.consensusProtocolVersion = protocols.filter(_ref2 => {
|
|
96
|
-
let {
|
|
97
|
-
effectiveAtHeight
|
|
98
|
-
} = _ref2;
|
|
99
|
-
return topBlockHeight >= effectiveAtHeight;
|
|
100
|
-
}).reduce((acc, p) => p.effectiveAtHeight > acc.effectiveAtHeight ? p : acc, {
|
|
101
|
-
effectiveAtHeight: -1,
|
|
102
|
-
version: 0
|
|
103
|
-
}).version;
|
|
104
|
-
this.nodeNetworkId = networkId;
|
|
105
|
-
return Object.assign(this, {
|
|
106
|
-
revision,
|
|
107
|
-
genesisHash
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
methods: {
|
|
112
|
-
getNodeInfo() {
|
|
113
|
-
return {
|
|
114
|
-
url: this.url,
|
|
115
|
-
internalUrl: this.internalUrl,
|
|
116
|
-
nodeNetworkId: this.nodeNetworkId,
|
|
117
|
-
version: this.version,
|
|
118
|
-
consensusProtocolVersion: this.consensusProtocolVersion
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
props: {
|
|
124
|
-
version: null,
|
|
125
|
-
consensusProtocolVersion: null,
|
|
126
|
-
nodeNetworkId: null
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
const NODE_GE_VERSION = '6.2.0';
|
|
130
|
-
const NODE_LT_VERSION = '7.0.0';
|
|
131
|
-
export default Node;
|
|
132
|
-
//# sourceMappingURL=node.js.map
|
package/es/node.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/node.js"],"names":["AsyncInit","genSwaggerClient","semverSatisfies","getNetworkId","networkId","force","res","selectedNode","Error","Node","compose","init","url","internalUrl","ignoreVersion","replace","client","responseInterceptor","response","ok","Object","assign","statusText","URL","pathname","slice","body","reason","version","spec","info","NODE_GE_VERSION","NODE_LT_VERSION","api","nodeRevision","revision","genesisKeyBlockHash","genesisHash","protocols","topBlockHeight","getStatus","consensusProtocolVersion","filter","effectiveAtHeight","reduce","acc","p","nodeNetworkId","methods","getNodeInfo","props"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAOA,SAAP,MAAsB,oBAAtB;AACA,OAAOC,gBAAP,MAA6B,iBAA7B;AACA,OAAOC,eAAP,MAA4B,0BAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,GAA0D;AAAA;;AAAA,MAAnC;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,KAAK,GAAG;AAArB,GAAmC,uEAAJ,EAAI;AAC/D,QAAMC,GAAG,GAAGF,SAAS,IAAI,KAAKA,SAAlB,2BAA+B,KAAKG,YAApC,uDAA+B,mBAAmBH,SAAlD,CAAZ;AACA,MAAI,CAACC,KAAD,IAAU,CAACC,GAAf,EAAoB,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,KAAK,EAAE;AACLtB,IAAAA,OAAO,EAAE,IADJ;AAELa,IAAAA,wBAAwB,EAAE,IAFrB;AAGLM,IAAAA,aAAa,EAAE;AAHV;AAnDsB,CAAlB,CAAb;AA0DA,MAAMhB,eAAe,GAAG,OAAxB;AACA,MAAMC,eAAe,GAAG,OAAxB;AAEA,eAAevB,IAAf","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2021 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 * Node module\n * @module @aeternity/aepp-sdk/es/node\n * @export Node\n * @example import { Node } from '@aeternity/aepp-sdk'\n */\n\nimport AsyncInit from './utils/async-init'\nimport genSwaggerClient from './utils/swagger'\nimport semverSatisfies from './utils/semver-satisfies'\n\n/**\n * Obtain networkId from account or node\n * @instance\n * @category async\n * @rtype () => networkId: String\n * @return {String} NetworkId\n */\nexport function getNetworkId ({ networkId, force = false } = {}) {\n const res = networkId || this.networkId || this.selectedNode?.networkId\n if (!force && !res) throw new Error('networkId is not provided')\n if (force && !res) return null\n return res\n}\n\n/**\n * {@link genSwaggerClient} based Node remote API Stamp\n * @function\n * @alias module:@aeternity/aepp-sdk/es/node\n * @rtype Stamp\n * @param {Object} [options={}] - Options\n * @param {String} options.url - Base URL for Node\n * @param {String} options.internalUrl - Base URL for internal requests\n * @param {Object} options.axiosConfig - Object with axios configuration\n * @param {Object} options.axiosConfig.config\n * @param {Function} options.axiosConfig.errorHandler - (err) => throw err\n * @return {Object} Node client\n * @example Node({url: 'https://testnet.aeternity.io'})\n */\nconst Node = AsyncInit.compose({\n async init ({ url, internalUrl, ignoreVersion }) {\n if (!url) throw new Error('\"url\" required')\n this.url = url.replace(/\\/$/, '')\n this.internalUrl = internalUrl ? internalUrl.replace(/\\/$/, '') : this.url\n const client = await genSwaggerClient(`${this.url}/api?oas3`, {\n internalUrl: this.internalUrl,\n responseInterceptor: response => {\n if (response.ok) return\n return Object.assign(response, {\n statusText: `${new URL(response.url).pathname.slice(1)} error: ` + response.body.reason\n })\n }\n })\n this.version = client.spec.info.version\n if (\n !semverSatisfies(this.version, NODE_GE_VERSION, NODE_LT_VERSION) &&\n !ignoreVersion\n ) {\n throw new Error(\n `Unsupported node version ${this.version}. ` +\n `Supported: >= ${NODE_GE_VERSION} < ${NODE_LT_VERSION}`\n )\n }\n this.api = client.api\n\n const {\n nodeRevision: revision, genesisKeyBlockHash: genesisHash, networkId,\n protocols, topBlockHeight\n } = await this.api.getStatus()\n this.consensusProtocolVersion = protocols\n .filter(({ effectiveAtHeight }) => topBlockHeight >= effectiveAtHeight)\n .reduce(\n (acc, p) => p.effectiveAtHeight > acc.effectiveAtHeight ? p : acc,\n { effectiveAtHeight: -1, version: 0 }\n )\n .version\n this.nodeNetworkId = networkId\n return Object.assign(this, { revision, genesisHash })\n },\n methods: {\n getNodeInfo () {\n return {\n url: this.url,\n internalUrl: this.internalUrl,\n nodeNetworkId: this.nodeNetworkId,\n version: this.version,\n consensusProtocolVersion: this.consensusProtocolVersion\n }\n }\n },\n props: {\n version: null,\n consensusProtocolVersion: null,\n nodeNetworkId: null\n }\n})\n\nconst NODE_GE_VERSION = '6.2.0'\nconst NODE_LT_VERSION = '7.0.0'\n\nexport default Node\n"],"file":"node.js"}
|
package/es/other.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare const pause: (duration: number) => Promise<void>;
|
|
2
|
-
export declare const mapObject: (object: object, fn: (value: [string, any], index: number, array: Array<[string, any]>) => Array<[string, any]>) => object;
|
|
3
|
-
export declare const filterObject: (object: object, fn: (value: [string, any], index: number, array: Array<[string, any]>) => boolean) => object;
|
|
4
|
-
/**
|
|
5
|
-
* Key traversal metafunction
|
|
6
|
-
* @static
|
|
7
|
-
* @function
|
|
8
|
-
* @rtype (fn: (s: String) => String) => (o: Object) => Object
|
|
9
|
-
* @param {Function} fn - Key transformation function
|
|
10
|
-
* @param {Object} object - Object to traverse
|
|
11
|
-
* @return {Object} Transformed object
|
|
12
|
-
*/
|
|
13
|
-
export declare const traverseKeys: (fn: Function, object: any) => any;
|
|
14
|
-
/**
|
|
15
|
-
* snake_case key traversal
|
|
16
|
-
* @static
|
|
17
|
-
* @rtype (o: Object) => Object
|
|
18
|
-
* @param {Object} object - Object to traverse
|
|
19
|
-
* @return {Object} Transformed object
|
|
20
|
-
* @see pascalToSnake
|
|
21
|
-
*/
|
|
22
|
-
export declare const snakizeKeys: any;
|
|
23
|
-
/**
|
|
24
|
-
* PascalCase key traversal
|
|
25
|
-
* @static
|
|
26
|
-
* @rtype (o: Object) => Object
|
|
27
|
-
* @param {Object} object - Object to traverse
|
|
28
|
-
* @return {Object} Transformed object
|
|
29
|
-
* @see snakeToPascal
|
|
30
|
-
*/
|
|
31
|
-
export declare const pascalizeKeys: any;
|