@aeternity/aepp-sdk 13.0.0-beta.0 → 13.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/README.md +1 -1
- 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 +47 -24
- package/dist/aepp-sdk.js.map +1 -1
- package/es/AeSdkAepp.d.ts +5 -4
- package/es/AeSdkAepp.mjs +13 -17
- package/es/AeSdkAepp.mjs.map +1 -1
- package/es/account/Generalized.mjs +1 -1
- package/es/account/Generalized.mjs.map +1 -1
- package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
- package/es/chain.mjs +1 -1
- package/es/chain.mjs.map +1 -1
- package/es/contract/Contract.mjs +23 -4
- package/es/contract/Contract.mjs.map +1 -1
- package/es/contract/compiler/Base.d.ts +3 -0
- package/es/contract/compiler/Base.mjs.map +1 -1
- package/es/index-browser.d.ts +1 -1
- package/es/index-browser.mjs +1 -1
- package/es/index-browser.mjs.map +1 -1
- package/es/utils/errors.mjs +1 -1
- package/es/utils/errors.mjs.map +1 -1
- package/package.json +3 -3
- package/src/AeSdkAepp.ts +16 -14
- package/src/account/Generalized.ts +1 -1
- package/src/aepp-wallet-communication/rpc/types.ts +1 -0
- package/src/chain.ts +1 -1
- package/src/contract/Contract.ts +28 -7
- package/src/contract/compiler/Base.ts +3 -0
- package/src/index-browser.ts +3 -1
- package/src/utils/errors.ts +1 -1
- package/types-legacy/ts4.2/AeSdkAepp.d.ts +5 -4
- package/types-legacy/ts4.2/contract/compiler/Base.d.ts +3 -0
- package/types-legacy/ts4.2/index-browser.d.ts +1 -1
- package/types-legacy/ts4.5/AeSdkAepp.d.ts +5 -4
- package/types-legacy/ts4.5/contract/compiler/Base.d.ts +3 -0
- package/types-legacy/ts4.5/index-browser.d.ts +1 -1
package/dist/aepp-sdk.js
CHANGED
|
@@ -5109,6 +5109,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5109
5109
|
"DryRunError": () => (/* reexport */ DryRunError),
|
|
5110
5110
|
"DuplicateContractError": () => (/* reexport */ DuplicateContractError),
|
|
5111
5111
|
"DuplicateNodeError": () => (/* reexport */ DuplicateNodeError),
|
|
5112
|
+
"Encoded": () => (/* reexport */ encoder_types_namespaceObject),
|
|
5112
5113
|
"Encoding": () => (/* reexport */ Encoding),
|
|
5113
5114
|
"IllegalArgumentError": () => (/* reexport */ IllegalArgumentError),
|
|
5114
5115
|
"IllegalBidFeeError": () => (/* reexport */ IllegalBidFeeError),
|
|
@@ -5292,6 +5293,13 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5292
5293
|
"walletDetector": () => (/* reexport */ wallet_detector)
|
|
5293
5294
|
});
|
|
5294
5295
|
|
|
5296
|
+
// NAMESPACE OBJECT: ./src/utils/encoder-types.ts
|
|
5297
|
+
var encoder_types_namespaceObject = {};
|
|
5298
|
+
__webpack_require__.r(encoder_types_namespaceObject);
|
|
5299
|
+
__webpack_require__.d(encoder_types_namespaceObject, {
|
|
5300
|
+
"Encoding": () => (Encoding)
|
|
5301
|
+
});
|
|
5302
|
+
|
|
5295
5303
|
// NAMESPACE OBJECT: ./src/apis/node/models/mappers.ts
|
|
5296
5304
|
var mappers_namespaceObject = {};
|
|
5297
5305
|
__webpack_require__.r(mappers_namespaceObject);
|
|
@@ -5987,7 +5995,7 @@ class MissingContractAddressError extends ContractError {
|
|
|
5987
5995
|
*/
|
|
5988
5996
|
class MissingContractDefError extends ContractError {
|
|
5989
5997
|
constructor() {
|
|
5990
|
-
super('Either ACI or
|
|
5998
|
+
super('Either ACI or sourceCode or sourceCodePath is required');
|
|
5991
5999
|
this.name = 'MissingContractDefError';
|
|
5992
6000
|
}
|
|
5993
6001
|
}
|
|
@@ -14860,7 +14868,7 @@ async function getHeight({
|
|
|
14860
14868
|
* @returns The transaction as it was mined
|
|
14861
14869
|
*/
|
|
14862
14870
|
async function poll(th, {
|
|
14863
|
-
blocks =
|
|
14871
|
+
blocks = 5,
|
|
14864
14872
|
interval,
|
|
14865
14873
|
onNode,
|
|
14866
14874
|
...options
|
|
@@ -15991,9 +15999,22 @@ class Contract {
|
|
|
15991
15999
|
*/
|
|
15992
16000
|
async $compile() {
|
|
15993
16001
|
if (this.$options.bytecode != null) return this.$options.bytecode;
|
|
15994
|
-
if (this.$options.sourceCode == null) throw new IllegalArgumentError('Can\'t compile without source code');
|
|
15995
16002
|
if (this.$options.onCompiler == null) throw new IllegalArgumentError('Can\'t compile without compiler');
|
|
15996
|
-
|
|
16003
|
+
if (this.$options.sourceCode != null) {
|
|
16004
|
+
const {
|
|
16005
|
+
bytecode
|
|
16006
|
+
} = await this.$options.onCompiler.compileBySourceCode(this.$options.sourceCode, this.$options.fileSystem);
|
|
16007
|
+
this.$options.bytecode = bytecode;
|
|
16008
|
+
}
|
|
16009
|
+
if (this.$options.sourceCodePath != null) {
|
|
16010
|
+
const {
|
|
16011
|
+
bytecode
|
|
16012
|
+
} = await this.$options.onCompiler.compile(this.$options.sourceCodePath);
|
|
16013
|
+
this.$options.bytecode = bytecode;
|
|
16014
|
+
}
|
|
16015
|
+
if (this.$options.bytecode == null) {
|
|
16016
|
+
throw new IllegalArgumentError('Can\'t compile without sourceCode and sourceCodePath');
|
|
16017
|
+
}
|
|
15997
16018
|
return this.$options.bytecode;
|
|
15998
16019
|
}
|
|
15999
16020
|
async $getCallResultByTxHash(hash, fnName, options) {
|
|
@@ -16256,7 +16277,7 @@ class Contract {
|
|
|
16256
16277
|
onNode
|
|
16257
16278
|
});
|
|
16258
16279
|
}
|
|
16259
|
-
if (address == null && sourceCode == null && bytecode == null) {
|
|
16280
|
+
if (address == null && sourceCode == null && sourceCodePath == null && bytecode == null) {
|
|
16260
16281
|
throw new MissingContractAddressError('Can\'t create instance by ACI without address');
|
|
16261
16282
|
}
|
|
16262
16283
|
if (address != null) {
|
|
@@ -16274,13 +16295,19 @@ class Contract {
|
|
|
16274
16295
|
if (bytecode != null) isValid = bytecode === onChanBytecode;else if (sourceCode != null) {
|
|
16275
16296
|
if (onCompiler == null) throw new IllegalArgumentError('Can\'t validate bytecode without compiler');
|
|
16276
16297
|
isValid = await onCompiler.validateBySourceCode(onChanBytecode, sourceCode, fileSystem);
|
|
16298
|
+
} else if (sourceCodePath != null) {
|
|
16299
|
+
if (onCompiler == null) throw new IllegalArgumentError('Can\'t validate bytecode without compiler');
|
|
16300
|
+
isValid = await onCompiler.validate(onChanBytecode, sourceCodePath);
|
|
16301
|
+
}
|
|
16302
|
+
if (!isValid) {
|
|
16303
|
+
throw new BytecodeMismatchError((sourceCode !== null && sourceCode !== void 0 ? sourceCode : sourceCodePath) != null ? 'source code' : 'bytecode');
|
|
16277
16304
|
}
|
|
16278
|
-
if (!isValid) throw new BytecodeMismatchError(sourceCode != null ? 'source code' : 'bytecode');
|
|
16279
16305
|
}
|
|
16280
16306
|
return new ContractWithMethods({
|
|
16281
16307
|
onCompiler,
|
|
16282
16308
|
onNode,
|
|
16283
16309
|
sourceCode,
|
|
16310
|
+
sourceCodePath,
|
|
16284
16311
|
bytecode,
|
|
16285
16312
|
aci,
|
|
16286
16313
|
address,
|
|
@@ -17741,11 +17768,19 @@ class AeSdkAepp extends AeSdkBase {
|
|
|
17741
17768
|
*/
|
|
17742
17769
|
async connectToWallet(connection, {
|
|
17743
17770
|
connectNode = false,
|
|
17744
|
-
name = 'wallet-node'
|
|
17745
|
-
select = false
|
|
17771
|
+
name = 'wallet-node'
|
|
17746
17772
|
} = {}) {
|
|
17747
17773
|
if (this.rpcClient != null) throw new AlreadyConnectedError('You are already connected to wallet');
|
|
17748
17774
|
let disconnectParams;
|
|
17775
|
+
const updateNetwork = params => {
|
|
17776
|
+
if (connectNode) {
|
|
17777
|
+
var _params$node;
|
|
17778
|
+
if (((_params$node = params.node) === null || _params$node === void 0 ? void 0 : _params$node.url) == null) throw new RpcConnectionError('Missing URLs of the Node');
|
|
17779
|
+
this.pool.delete(name);
|
|
17780
|
+
this.addNode(name, new Node_Node(params.node.url), true);
|
|
17781
|
+
}
|
|
17782
|
+
this.onNetworkChange(params);
|
|
17783
|
+
};
|
|
17749
17784
|
const client = new RpcClient(connection, () => {
|
|
17750
17785
|
delete this.rpcClient;
|
|
17751
17786
|
delete this._accounts;
|
|
@@ -17755,31 +17790,19 @@ class AeSdkAepp extends AeSdkBase {
|
|
|
17755
17790
|
this._accounts = params;
|
|
17756
17791
|
this.onAddressChange(params);
|
|
17757
17792
|
},
|
|
17758
|
-
[METHODS.updateNetwork]:
|
|
17759
|
-
const {
|
|
17760
|
-
node
|
|
17761
|
-
} = params;
|
|
17762
|
-
if (node != null) this.addNode(node.name, new Node_Node(node.url), true);
|
|
17763
|
-
this.onNetworkChange(params);
|
|
17764
|
-
},
|
|
17793
|
+
[METHODS.updateNetwork]: updateNetwork,
|
|
17765
17794
|
[METHODS.closeConnection]: params => {
|
|
17766
17795
|
disconnectParams = params;
|
|
17767
17796
|
client.connection.disconnect();
|
|
17768
17797
|
},
|
|
17769
17798
|
[METHODS.readyToConnect]: () => {}
|
|
17770
17799
|
});
|
|
17771
|
-
const {
|
|
17772
|
-
node,
|
|
17773
|
-
...walletInfo
|
|
17774
|
-
} = await client.request(METHODS.connect, {
|
|
17800
|
+
const walletInfo = await client.request(METHODS.connect, {
|
|
17775
17801
|
name: this.name,
|
|
17776
17802
|
version: RPC_VERSION,
|
|
17777
17803
|
connectNode
|
|
17778
17804
|
});
|
|
17779
|
-
|
|
17780
|
-
if (node == null) throw new RpcConnectionError('Missing URLs of the Node');
|
|
17781
|
-
this.addNode(name, new Node_Node(node.url), select);
|
|
17782
|
-
}
|
|
17805
|
+
updateNetwork(walletInfo);
|
|
17783
17806
|
this.rpcClient = client;
|
|
17784
17807
|
return walletInfo;
|
|
17785
17808
|
}
|
|
@@ -18196,7 +18219,7 @@ class AccountGeneralized extends AccountBase {
|
|
|
18196
18219
|
throw new InternalError('Account in generalised, but authFun not provided');
|
|
18197
18220
|
}
|
|
18198
18221
|
if (sourceCode == null || args == null) {
|
|
18199
|
-
throw new InvalidAuthDataError('Auth data must contain
|
|
18222
|
+
throw new InvalidAuthDataError('Auth data must contain sourceCode and args or callData.');
|
|
18200
18223
|
}
|
|
18201
18224
|
const contract = await contract_Contract.initialize({
|
|
18202
18225
|
onCompiler,
|