Skip to content

Commit

Permalink
chore(node)!: require 7.1.0
Browse files Browse the repository at this point in the history
BREAKING CHANGE: sdk requires aeternity node 7.1.0 and above
  • Loading branch information
davidyuk committed Jun 8, 2024
1 parent f2c6d1d commit 0dd3b49
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
node:
# TODO: switch to master after merging https://github.com/aeternity/aeternity/pull/4303
image: aeternity/aeternity:v7.0.0-rc1-bundle
image: aeternity/aeternity:v7.1.0-bundle
# TODO: remove 3313 port after merging https://github.com/aeternity/aeternity/pull/4303
ports: [3013:3013, 3113:3113, 3014:3014, 3313:3313]
# TODO: remove after releasing https://github.com/aeternity/aeternity/pull/4292
Expand Down
2 changes: 1 addition & 1 deletion src/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default class Node extends (NodeTransformed as unknown as NodeTransformed
super(url, {
allowInsecureConnection: true,
additionalPolicies: [
...ignoreVersion ? [] : [genVersionCheckPolicy('node', getVersion, '6.2.0', '8.0.0')],
...ignoreVersion ? [] : [genVersionCheckPolicy('node', getVersion, '7.1.0', '8.0.0')],
genRequestQueuesPolicy(),
genCombineGetRequestsPolicy(),
genRetryOnFailurePolicy(retryCount, retryOverallDelay),
Expand Down
5 changes: 0 additions & 5 deletions src/tx/builder/field-types/gas-price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ArgumentError, IllegalArgumentError } from '../../../utils/errors';
import { Int, MIN_GAS_PRICE } from '../constants';
import Node from '../../../Node';
import { AE_AMOUNT_FORMATS, formatAmount } from '../../../utils/amount-formatter';
import semverSatisfies from '../../../utils/semver-satisfies';

const gasPriceCache: WeakMap<Node, { time: number; gasPrice: bigint }> = new WeakMap();

Expand All @@ -14,10 +13,6 @@ export async function getCachedIncreasedGasPrice(node: Node): Promise<bigint> {
return cache.gasPrice;
}

// TODO: remove after requiring node@6.13.0
const { nodeVersion } = await node._getCachedStatus();
if (!semverSatisfies(nodeVersion, '6.13.0')) return 0n;

const { minGasPrice, utilization } = (await node.getRecentGasPrices())[0];
let gasPrice = utilization < 70 ? 0n : BigInt(
new BigNumber(minGasPrice.toString()).times(1.01).integerValue().toFixed(),
Expand Down
9 changes: 7 additions & 2 deletions test/integration/aens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ describe('Aens', () => {
channel: encode(decode(address), Encoding.Channel),
contract_pubkey: buildContractId(address, 13),
};
pointersNode = Object.entries(pointers).map(([key, id]) => ({ key, id }));
pointersNode = Object.entries(pointers)
.map(([key, id]) => ({ key, id, encodedKey: encode(Buffer.from(key), Encoding.Bytearray) }));
});

it('updates', async () => {
Expand Down Expand Up @@ -294,7 +295,11 @@ describe('Aens', () => {
assertNotNull(updateRes.tx);
expect(updateRes.tx.pointers).to.be.eql([
...pointersNode.filter((pointer) => pointer.key !== 'contract_pubkey'),
{ key: 'contract_pubkey', id: anotherContract },
{
key: 'contract_pubkey',
id: anotherContract,
encodedKey: 'ba_Y29udHJhY3RfcHVia2V5OCcARA==',
},
]);
});

Expand Down
2 changes: 2 additions & 0 deletions test/integration/delegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ contract DelegateTest =
expect((await aeSdk.api.getNameEntryByName(name)).pointers).to.be.eql([{
key: 'oracle',
id: newOwner.replace('ak', 'ok'),
encodedKey: 'ba_b3JhY2xlzgFUsQ==',
}]);
});

Expand All @@ -151,6 +152,7 @@ contract DelegateTest =
expect((await aeSdk.api.getNameEntryByName(name)).pointers[0]).to.be.eql({
key: 'test key',
id: encode(dataPt, Encoding.Bytearray),
encodedKey: 'ba_dGVzdCBrZXk//Xo5',
});
});

Expand Down
2 changes: 1 addition & 1 deletion tooling/autorest/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ version: ^3.7.1
use-extension:
'@autorest/typescript': ^6.0.15
'@autorest/modelerfour': ^4.27.0
input-file: https://raw.githubusercontent.com/aeternity/aeternity/v6.13.0/apps/aehttp/priv/oas3.yaml
input-file: https://raw.githubusercontent.com/aeternity/aeternity/v7.1.0/apps/aehttp/priv/oas3.yaml
output-folder: ../../src/apis/node
source-code-folder-path: .
generator: typescript
Expand Down

0 comments on commit 0dd3b49

Please sign in to comment.