@aeternity/aepp-sdk 13.3.0 → 13.3.2
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_8 +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 +37 -44
- package/dist/aepp-sdk.js.map +1 -1
- package/es/Node.mjs +1 -1
- package/es/Node.mjs.map +1 -1
- package/es/chain.d.ts +5 -5
- package/es/chain.mjs +18 -20
- package/es/chain.mjs.map +1 -1
- package/es/contract/Contract.mjs +3 -0
- package/es/contract/Contract.mjs.map +1 -1
- package/es/oracle.d.ts +2 -2
- package/es/oracle.mjs +6 -10
- package/es/oracle.mjs.map +1 -1
- package/es/tx/builder/field-types/gas-price.mjs +1 -4
- package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
- package/es/tx/builder/field-types/ttl.d.ts +3 -2
- package/es/tx/builder/field-types/ttl.mjs.map +1 -1
- package/es/tx/builder/schema.d.ts +69 -46
- package/es/utils/semver-satisfies.d.ts +1 -1
- package/es/utils/semver-satisfies.mjs +8 -9
- package/es/utils/semver-satisfies.mjs.map +1 -1
- package/package.json +2 -2
- package/src/Node.ts +1 -1
- package/src/chain.ts +28 -18
- package/src/contract/Contract.ts +3 -0
- package/src/oracle.ts +7 -7
- package/src/tx/builder/field-types/gas-price.ts +1 -4
- package/src/tx/builder/field-types/ttl.ts +1 -1
- package/src/utils/semver-satisfies.ts +14 -13
- package/types-legacy/ts4.2/chain.d.ts +5 -5
- package/types-legacy/ts4.2/oracle.d.ts +2 -2
- package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +3 -2
- package/types-legacy/ts4.2/tx/builder/schema.d.ts +69 -46
- package/types-legacy/ts4.2/utils/semver-satisfies.d.ts +1 -1
- package/types-legacy/ts4.5/chain.d.ts +5 -5
- package/types-legacy/ts4.5/oracle.d.ts +2 -2
- package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +3 -2
- package/types-legacy/ts4.5/tx/builder/schema.d.ts +69 -46
- package/types-legacy/ts4.5/utils/semver-satisfies.d.ts +1 -1
package/dist/aepp-sdk.js
CHANGED
|
@@ -7943,16 +7943,20 @@ function isAuctionName(name) {
|
|
|
7943
7943
|
* @param type - Type
|
|
7944
7944
|
* @param options - Options
|
|
7945
7945
|
*/
|
|
7946
|
-
function _getPollInterval(type,
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
_microBlockCycle = 3000
|
|
7946
|
+
async function _getPollInterval(type, {
|
|
7947
|
+
_expectedMineRate,
|
|
7948
|
+
_microBlockCycle,
|
|
7949
|
+
onNode
|
|
7951
7950
|
}) {
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7951
|
+
var _ref, _await$getVal;
|
|
7952
|
+
const getVal = async (t, val, devModeDef, def) => {
|
|
7953
|
+
if (t !== type) return null;
|
|
7954
|
+
if (val != null) return val;
|
|
7955
|
+
return (await (onNode === null || onNode === void 0 ? void 0 : onNode.getNetworkId())) === 'ae_dev' ? devModeDef : def;
|
|
7956
|
+
};
|
|
7957
|
+
const base = (_ref = (_await$getVal = await getVal('key-block', _expectedMineRate, 0, 180000)) !== null && _await$getVal !== void 0 ? _await$getVal : await getVal('micro-block', _microBlockCycle, 0, 3000)) !== null && _ref !== void 0 ? _ref : (() => {
|
|
7958
|
+
throw new InternalError(`Unknown type: ${type}`);
|
|
7959
|
+
})();
|
|
7956
7960
|
return Math.floor(base / 3);
|
|
7957
7961
|
}
|
|
7958
7962
|
const heightCache = new WeakMap();
|
|
@@ -7973,7 +7977,7 @@ async function getHeight({
|
|
|
7973
7977
|
const onNode = unwrapProxy(options.onNode);
|
|
7974
7978
|
if (cached) {
|
|
7975
7979
|
const cache = heightCache.get(onNode);
|
|
7976
|
-
if (cache != null && cache.time > Date.now() - _getPollInterval('block', options)) {
|
|
7980
|
+
if (cache != null && cache.time > Date.now() - (await _getPollInterval('key-block', options))) {
|
|
7977
7981
|
return cache.height;
|
|
7978
7982
|
}
|
|
7979
7983
|
}
|
|
@@ -8002,26 +8006,23 @@ async function getHeight({
|
|
|
8002
8006
|
async function poll(th, {
|
|
8003
8007
|
blocks = 5,
|
|
8004
8008
|
interval,
|
|
8005
|
-
onNode,
|
|
8006
8009
|
...options
|
|
8007
8010
|
}) {
|
|
8008
8011
|
var _interval;
|
|
8009
|
-
(_interval = interval) !== null && _interval !== void 0 ? _interval : interval = _getPollInterval('
|
|
8012
|
+
(_interval = interval) !== null && _interval !== void 0 ? _interval : interval = await _getPollInterval('micro-block', options);
|
|
8010
8013
|
let max;
|
|
8011
8014
|
do {
|
|
8012
|
-
const tx = await onNode.getTransactionByHash(th);
|
|
8015
|
+
const tx = await options.onNode.getTransactionByHash(th);
|
|
8013
8016
|
if (tx.blockHeight !== -1) return tx;
|
|
8014
8017
|
if (max == null) {
|
|
8015
8018
|
max = tx.tx.ttl !== 0 ? -1 : (await getHeight({
|
|
8016
8019
|
...options,
|
|
8017
|
-
onNode,
|
|
8018
8020
|
cached: true
|
|
8019
8021
|
})) + blocks;
|
|
8020
8022
|
}
|
|
8021
8023
|
await pause(interval);
|
|
8022
8024
|
} while (max === -1 ? true : (await getHeight({
|
|
8023
8025
|
...options,
|
|
8024
|
-
onNode,
|
|
8025
8026
|
cached: true
|
|
8026
8027
|
})) < max);
|
|
8027
8028
|
throw new TxTimedOutError(blocks, th);
|
|
@@ -8038,17 +8039,14 @@ async function poll(th, {
|
|
|
8038
8039
|
*/
|
|
8039
8040
|
async function awaitHeight(height, {
|
|
8040
8041
|
interval,
|
|
8041
|
-
onNode,
|
|
8042
8042
|
...options
|
|
8043
8043
|
}) {
|
|
8044
8044
|
var _interval2;
|
|
8045
|
-
(_interval2 = interval) !== null && _interval2 !== void 0 ? _interval2 : interval = Math.min(_getPollInterval('block', options), 5000);
|
|
8045
|
+
(_interval2 = interval) !== null && _interval2 !== void 0 ? _interval2 : interval = Math.min(await _getPollInterval('key-block', options), 5000);
|
|
8046
8046
|
let currentHeight;
|
|
8047
8047
|
do {
|
|
8048
8048
|
if (currentHeight != null) await pause(interval);
|
|
8049
|
-
currentHeight = await getHeight(
|
|
8050
|
-
onNode
|
|
8051
|
-
});
|
|
8049
|
+
currentHeight = await getHeight(options);
|
|
8052
8050
|
} while (currentHeight < height);
|
|
8053
8051
|
return currentHeight;
|
|
8054
8052
|
}
|
|
@@ -8669,17 +8667,16 @@ function genEncodedField(encoding, optional) {
|
|
|
8669
8667
|
}
|
|
8670
8668
|
});
|
|
8671
8669
|
;// CONCATENATED MODULE: ./src/utils/semver-satisfies.ts
|
|
8672
|
-
function
|
|
8670
|
+
function verCmp(a, b) {
|
|
8673
8671
|
const getComponents = v => v.split(/[-+]/)[0].split('.').map(i => +i);
|
|
8674
|
-
const
|
|
8675
|
-
const
|
|
8676
|
-
const
|
|
8677
|
-
const base = Math.max(...versionComponents, ...geComponents, ...ltComponents) + 1;
|
|
8672
|
+
const aComponents = getComponents(a);
|
|
8673
|
+
const bComponents = getComponents(b);
|
|
8674
|
+
const base = Math.max(...aComponents, ...bComponents) + 1;
|
|
8678
8675
|
const componentsToNumber = components => components.reverse().reduce((acc, n, idx) => acc + n * base ** idx, 0);
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
return
|
|
8676
|
+
return componentsToNumber(aComponents) - componentsToNumber(bComponents);
|
|
8677
|
+
}
|
|
8678
|
+
function semverSatisfies(version, geVersion, ltVersion) {
|
|
8679
|
+
return verCmp(version, geVersion) >= 0 && (ltVersion == null || verCmp(version, ltVersion) < 0);
|
|
8683
8680
|
}
|
|
8684
8681
|
;// CONCATENATED MODULE: ./src/tx/builder/field-types/gas-price.ts
|
|
8685
8682
|
|
|
@@ -8699,10 +8696,7 @@ async function getCachedIncreasedGasPrice(node) {
|
|
|
8699
8696
|
const {
|
|
8700
8697
|
nodeVersion
|
|
8701
8698
|
} = await node._getCachedStatus();
|
|
8702
|
-
|
|
8703
|
-
if (!nodeVersion.startsWith('6.12.0+') && !semverSatisfies(nodeVersion, '6.13.0', '7.0.0')) {
|
|
8704
|
-
return 0n;
|
|
8705
|
-
}
|
|
8699
|
+
if (!semverSatisfies(nodeVersion, '6.13.0')) return 0n;
|
|
8706
8700
|
const {
|
|
8707
8701
|
minGasPrice,
|
|
8708
8702
|
utilization
|
|
@@ -16199,7 +16193,7 @@ class Node_Node extends NodeTransformed {
|
|
|
16199
16193
|
// eslint-disable-next-line constructor-super
|
|
16200
16194
|
super(url, {
|
|
16201
16195
|
allowInsecureConnection: true,
|
|
16202
|
-
additionalPolicies: [...(ignoreVersion ? [] : [genVersionCheckPolicy('node', getVersion, '6.2.0', '
|
|
16196
|
+
additionalPolicies: [...(ignoreVersion ? [] : [genVersionCheckPolicy('node', getVersion, '6.2.0', '8.0.0')]), genRequestQueuesPolicy(), genCombineGetRequestsPolicy(), genRetryOnFailurePolicy(retryCount, retryOverallDelay), genErrorFormatterPolicy(body => [' ', body.reason, body.errorCode == null ? '' : ` (${body.errorCode})`].join(''))],
|
|
16203
16197
|
...options
|
|
16204
16198
|
});
|
|
16205
16199
|
Node_classPrivateFieldInitSpec(this, _cachedStatusPromise, {
|
|
@@ -18392,6 +18386,9 @@ function _getCallResult2({
|
|
|
18392
18386
|
break;
|
|
18393
18387
|
case 'error':
|
|
18394
18388
|
message = decode(returnValue).toString();
|
|
18389
|
+
if (/Expected \d+ arguments, got \d+/.test(message)) {
|
|
18390
|
+
throw new ContractError(`ACI doesn't match called contract. Error provided by node: ${message}`);
|
|
18391
|
+
}
|
|
18395
18392
|
break;
|
|
18396
18393
|
default:
|
|
18397
18394
|
throw new InternalError(`Unknown return type: ${returnType}`);
|
|
@@ -18483,15 +18480,12 @@ const ContractWithMethods = Contract;
|
|
|
18483
18480
|
*/
|
|
18484
18481
|
function pollForQueries(oracleId, onQuery, {
|
|
18485
18482
|
interval,
|
|
18486
|
-
onNode,
|
|
18487
18483
|
...options
|
|
18488
18484
|
}) {
|
|
18489
|
-
var _interval;
|
|
18490
|
-
(_interval = interval) !== null && _interval !== void 0 ? _interval : interval = _getPollInterval('microblock', options);
|
|
18491
18485
|
const knownQueryIds = new Set();
|
|
18492
18486
|
const checkNewQueries = async () => {
|
|
18493
|
-
var _await$onNode
|
|
18494
|
-
const queries = ((_await$onNode
|
|
18487
|
+
var _await$options$onNode;
|
|
18488
|
+
const queries = ((_await$options$onNode = (await options.onNode.getOracleQueriesByPubkey(oracleId)).oracleQueries) !== null && _await$options$onNode !== void 0 ? _await$options$onNode : []).filter(({
|
|
18495
18489
|
id
|
|
18496
18490
|
}) => !knownQueryIds.has(id));
|
|
18497
18491
|
queries.forEach(query => {
|
|
@@ -18502,7 +18496,8 @@ function pollForQueries(oracleId, onQuery, {
|
|
|
18502
18496
|
let stopped = false;
|
|
18503
18497
|
|
|
18504
18498
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
18505
|
-
(async
|
|
18499
|
+
(async _interval => {
|
|
18500
|
+
(_interval = interval) !== null && _interval !== void 0 ? _interval : interval = await _getPollInterval('micro-block', options);
|
|
18506
18501
|
while (!stopped) {
|
|
18507
18502
|
// eslint-disable-line no-unmodified-loop-condition
|
|
18508
18503
|
// TODO: allow to handle this error somehow
|
|
@@ -18527,11 +18522,10 @@ function pollForQueries(oracleId, onQuery, {
|
|
|
18527
18522
|
*/
|
|
18528
18523
|
async function pollForQueryResponse(oracleId, queryId, {
|
|
18529
18524
|
interval,
|
|
18530
|
-
onNode,
|
|
18531
18525
|
...options
|
|
18532
18526
|
}) {
|
|
18533
18527
|
var _interval2;
|
|
18534
|
-
(_interval2 = interval) !== null && _interval2 !== void 0 ? _interval2 : interval = _getPollInterval('
|
|
18528
|
+
(_interval2 = interval) !== null && _interval2 !== void 0 ? _interval2 : interval = await _getPollInterval('micro-block', options);
|
|
18535
18529
|
let height;
|
|
18536
18530
|
let ttl;
|
|
18537
18531
|
let response;
|
|
@@ -18539,13 +18533,12 @@ async function pollForQueryResponse(oracleId, queryId, {
|
|
|
18539
18533
|
({
|
|
18540
18534
|
response,
|
|
18541
18535
|
ttl
|
|
18542
|
-
} = await onNode.getOracleQueryByPubkeyAndQueryId(oracleId, queryId));
|
|
18536
|
+
} = await options.onNode.getOracleQueryByPubkeyAndQueryId(oracleId, queryId));
|
|
18543
18537
|
const responseBuffer = decode(response);
|
|
18544
18538
|
if (responseBuffer.length > 0) return responseBuffer.toString();
|
|
18545
18539
|
await pause(interval);
|
|
18546
18540
|
height = await getHeight({
|
|
18547
18541
|
...options,
|
|
18548
|
-
onNode,
|
|
18549
18542
|
cached: true
|
|
18550
18543
|
});
|
|
18551
18544
|
} while (ttl >= height);
|