Skip to content

Commit

Permalink
Merge pull request #2003 from aeternity/release/13.3.3
Browse files Browse the repository at this point in the history
Release v13.3.3
  • Loading branch information
davidyuk authored Jul 18, 2024
2 parents a6f7b75 + c8fe148 commit 8cf3b9f
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 64 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
BASE: ${{ github.event.pull_request.base.sha }}
run: npx commitlint --from $BASE --to $HEAD --verbose
- run: npm run lint
- run: npm run docs:examples && npm run docs:api && ./docs/build-assets.sh
if: contains(github.event.pull_request.title, 'Release')
- run: docker compose up -d --wait
- run: npx nyc npm test
- run: npx nyc report --reporter=text-lcov > coverage.lcov
Expand Down
2 changes: 1 addition & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
require: 'tooling/babel-register.js',
recursive: true,
extension: '.js,.ts',
timeout: process.env.NETWORK ? '500s' : '40s',
timeout: process.env.NETWORK ? '500s' : '8s',
ignore: 'test/environment/**',
exit: true // TODO: fix in state channel tests
}
15 changes: 15 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [13.3.3](https://github.com/aeternity/aepp-sdk-js/compare/v13.3.2...v13.3.3) (2024-07-17)


### Bug Fixes

* **account:** improve Account:publicKey type ([0524553](https://github.com/aeternity/aepp-sdk-js/commit/0524553267162be30476b2ccebdd3f2633e9bb73))
* **aens:** validate minus chars in name as node does ([15063c6](https://github.com/aeternity/aepp-sdk-js/commit/15063c68bbd4f6918648d9f23c069861d39dad98))
* **aepp:** don't require subscription to request addresses ([8ce976e](https://github.com/aeternity/aepp-sdk-js/commit/8ce976e470fe67487079534671d854ccd7f0d080))
* **channel:** `channelId` type, more accurate types ([2b064d8](https://github.com/aeternity/aepp-sdk-js/commit/2b064d8a2969f93c33c345e1822aaea5678e5e09))
* **channel:** accept `host` only if initiator ([cfdfd72](https://github.com/aeternity/aepp-sdk-js/commit/cfdfd725f3753b06d3b458d971c980ac9b0f3596))
* **channel:** remove `statePassword` unsupported on node side ([74db9bb](https://github.com/aeternity/aepp-sdk-js/commit/74db9bb68df997a10c1f7e4319616bb9b2a5612d))
* don't allow upgrades `@azure/core-rest-pipeline` ([03058d4](https://github.com/aeternity/aepp-sdk-js/commit/03058d4a26d2573aa5dd33915c86eb6140de42ff))
* don't allow upgrades `@ledgerhq/hw-transport` to 6.31.0 ([1ef43e6](https://github.com/aeternity/aepp-sdk-js/commit/1ef43e63fd2a75b891d3b13de03db67b6e5fac0d))
* **wallet:** origin if opened over file:// (cordova) ([4ee44be](https://github.com/aeternity/aepp-sdk-js/commit/4ee44bef2fab01a97771ed46e40f9fee3b343aad))

### [13.3.2](https://github.com/aeternity/aepp-sdk-js/compare/v13.3.1...v13.3.2) (2024-04-22)


Expand Down
33 changes: 17 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aeternity/aepp-sdk",
"version": "13.3.2",
"version": "13.3.3",
"description": "SDK for the æternity blockchain",
"main": "dist/aepp-sdk.js",
"types": "es/index.d.ts",
Expand Down Expand Up @@ -79,9 +79,10 @@
"@aeternity/argon2": "^0.0.1",
"@aeternity/uuid": "^0.0.1",
"@azure/core-client": "^1.8.0",
"@azure/core-rest-pipeline": "^1.14.0",
"@azure/core-rest-pipeline": "~1.14.0",
"@azure/logger": "~1.0.4",
"@babel/runtime-corejs3": "^7.24.0",
"@ledgerhq/hw-transport": "^6.30.4",
"@ledgerhq/hw-transport": "~6.30.6",
"@types/aes-js": "^3.1.4",
"@types/json-bigint": "^1.0.4",
"@types/node": "~18.13",
Expand Down
2 changes: 1 addition & 1 deletion src/AeSdkAepp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default class AeSdkAepp extends AeSdkBase {
* @returns Addresses from wallet
*/
async askAddresses(): Promise<Encoded.AccountAddress[]> {
this._ensureAccountAccess();
this._ensureConnected();
return this.rpcClient.request(METHODS.address, undefined);
}

Expand Down
3 changes: 2 additions & 1 deletion src/AeSdkWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,12 @@ export default class AeSdkWallet extends AeSdk {
* @returns Object with wallet information
*/
async getWalletInfo(): Promise<WalletInfo> {
const { origin } = window.location;
return {
id: this.id,
name: this.name,
networkId: await this.api.getNetworkId(),
origin: window.location.origin,
origin: origin === 'file://' ? '*' : origin,
type: this._type,
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/channel/Base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export default class Channel {
* })
* ```
*/
async leave(): Promise<{ channelId: Encoded.Bytearray; signedTx: Encoded.Transaction }> {
async leave(): Promise<{ channelId: Encoded.Channel; signedTx: Encoded.Transaction }> {
return this.enqueueAction(() => {
notify(this, 'channels.leave');
return { handler: handlers.awaitingLeave };
Expand Down
41 changes: 24 additions & 17 deletions src/channel/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type SignTx = (tx: Encoded.Transaction, options?: SignOptions) => (
/**
* @see {@link https://github.com/aeternity/protocol/blob/6734de2e4c7cce7e5e626caa8305fb535785131d/node/api/channels_api_usage.md#channel-establishing-parameters}
*/
export interface ChannelOptions {
interface CommonChannelOptions {
existingFsmId?: Encoded.Bytearray;
/**
* Channel url (for example: "ws://localhost:3001")
Expand All @@ -74,7 +74,7 @@ export interface ChannelOptions {
/**
* Initial deposit in favour of the responder by the initiator
*/
pushAmount: number;
pushAmount: BigNumber | number;
/**
* Amount of coins the initiator has committed to the channel
*/
Expand All @@ -92,17 +92,9 @@ export interface ChannelOptions {
*/
ttl?: number;
/**
* Host of the responder's node
*/
host: string;
/**
* The port of the responders node
* The port of the responder's node
*/
port: number;
/**
* Participant role
*/
role: 'initiator' | 'responder';
/**
* How to calculate minimum depth (default: txfee)
*/
Expand All @@ -120,16 +112,16 @@ export interface ChannelOptions {
*/
gasPrice?: BigNumber | number;

signedTx?: string;
signedTx?: Encoded.Transaction;
/**
* Existing channel id (required if reestablishing a channel)
*/
existingChannelId?: string;
existingChannelId?: Encoded.Channel;
/**
* Offchain transaction (required if reestablishing a channel)
*/
offChainTx?: string;
reconnectTx?: string;
offChainTx?: Encoded.Transaction;
reconnectTx?: Encoded.Transaction;
/**
* The time waiting for a new event to be initiated (default: 600000)
*/
Expand Down Expand Up @@ -174,7 +166,6 @@ export interface ChannelOptions {
* Applicable only for responder (default: timeout_idle's value)
*/
timeoutAwaitingOpen?: number;
statePassword?: string;
/**
* Log websocket communication and state changes
*/
Expand All @@ -183,9 +174,25 @@ export interface ChannelOptions {
* Function which verifies and signs transactions
*/
sign: SignTxWithTag;
offchainTx?: string;
offchainTx?: Encoded.Transaction;
}

export type ChannelOptions = CommonChannelOptions & ({
/**
* Participant role
*/
role: 'initiator';
/**
* Host of the responder's node
*/
host: string;
} | {
/**
* Participant role
*/
role: 'responder';
});

export interface ChannelHandler extends Function {
enter?: Function;
}
Expand Down
9 changes: 9 additions & 0 deletions src/tx/builder/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ export function nameToPunycode(maybeName: string): AensName {
if (/\p{Emoji_Presentation}/u.test(name)) {
throw new ArgumentError('aens name', 'not containing emoji', maybeName);
}
if (name[2] === '-' && name[3] === '-') {
throw new ArgumentError('aens name', 'without "-" char in both the third and fourth positions', maybeName);
}
if (name[0] === '-') {
throw new ArgumentError('aens name', 'starting with no "-" char', maybeName);
}
if (name.at(-1) === '-') {
throw new ArgumentError('aens name', 'ending with no "-" char', maybeName);
}
let punycode;
try {
const u = new URL(`http://${name}.${suffix}`);
Expand Down
8 changes: 5 additions & 3 deletions src/utils/hd-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import nacl from 'tweetnacl';
import { full as hmac } from 'tweetnacl-auth';
import { fromString } from 'bip32-path';
import aesjs from 'aes-js';
import { sha256hash, encode, Encoding } from './encoder';
import {
sha256hash, encode, Encoding, Encoded,
} from './encoder';
import { CryptographyError } from './errors';
import { concatBuffers } from './other';

Expand Down Expand Up @@ -58,8 +60,8 @@ interface HDWallet {
}

interface Account {
secretKey: string;
publicKey: string;
secretKey: string; // TODO: use Encoded.AccountSecretKey instead hex
publicKey: Encoded.AccountAddress;
}

type Dec<N extends number> = [-1, 0, 1, 2, 3, 4][N];
Expand Down
3 changes: 3 additions & 0 deletions test/integration/Middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('Middleware API', () => {
payload: {
block_hash: 'mh_LAo6Cg6d8LGDpxJ3se2aGJZbCubDZyC6GonHK58MKiW4a4LWb',
block_height: 779178,
encoded_tx: 'tx_+QEKCwHAuQEE+QEBUQKhAR1BkBtnVYcqjIhl7aOh9hEy9W96OFTeeQreTa3ExE/auG8rEWzyVws7Ap8AoLb4BE1sdD+LZw3SM+libDajr+a976yRMKi9b7k5whrinwEBAFGw3Ke65y52/KhwL5lYHOlRuOIZZy2V190M5H1ywIgN5fAylDfLImUL3WDwC4UAHa6EcyMc3Pl8apaHFuO79AMDhkduhMz4AILDUIQ7msoAuFr4WAsBwLhT+FEMAaEBHUGQG2dVhyqMiGXto6H2ETL1b3o4VN55Ct5NrcTET9qhAUCcLjbyYA3yE1vkfr0zC0M4oNrQ3lNoPHDD6EzUnVzAcIYPJvVhyAAAAIAv4MYN',
hash: 'th_YHj5aB6JzHciY5f6jqgtso8u2iY9p6MT9RV96FwXQNS1MpSML',
micro_index: 18,
micro_time: 1684995426848,
Expand Down Expand Up @@ -79,6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Y2UR33mHXEl0b19zaWduX3VucHJlZml4ZWQR5syMIzFnZXRfdHJ1c3RlZXMR8qxXhTlyZW1vdmVfdHJ1c3RlZRH5EvIfLWFkZF90cnVzdGVlgi8AhTcuMS4wAKBs8lcLChWZtwgpHlCqPa8T0MfySEvDN92tJBOjf9SgCYMHAAOGYg/MzLgAAIICVYQ7msoAqisRRNZEHxufAKC2+ARNbHQ/i2cN0jPpYmw2o6/mve+skTCovW+5OcIa4gGo5Xk=',
hash: 'th_AScnu6AAGHvfewMELKvmc6KH9jaMfzopGpcFFo1HAoS7ne1fD',
micro_index: 11,
micro_time: 1684995366595,
Expand Down Expand Up @@ -118,6 +120,7 @@ describe('Middleware API', () => {
payload: {
block_hash: 'mh_25snWYwTkU1xjPCcH592XVNzL894qSpF4yqnt8tABKGEVm6nSz',
block_height: 779178,
encoded_tx: 'tx_+K4LAfhCuEBjZgd36W2H8rB5KZzut7wvRnAsjJSD+CEg8Dbm8ivFXmDzKFauG8QJpnm9kmVnNl0xOI7xVsm0brXYTMNuAmUDuGb4ZAwBoQHhMrjx3begTmO3+pZHmlS7xSWlMafxvAzkkhIZAwZ/sKEBHUGQG2dVhyqMiGXto6H2ETL1b3o4VN55Ct5NrcTET9qIRWORgkT0AACGD39vJaAAAIKQmIlGYXVjZXQgVHiaKLKm',
hash: 'th_242zV1qXwag6iBH3Pd8zn3DQC37h4uP38CoFjkaTgT19AVKMHo',
micro_index: 7,
micro_time: 1684995336526,
Expand Down
8 changes: 4 additions & 4 deletions test/integration/MiddlewareSubscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('MiddlewareSubscriber', () => {
}),
]);
expect(transaction).to.be.eql(await fetchNodeRaw(`transactions/${hash}`));
}).timeout(80_000);
});

// TODO: enable after fixing https://github.com/aeternity/ae_mdw/issues/1337
it.skip('subscribes for account', async () => {
Expand All @@ -138,7 +138,7 @@ describe('MiddlewareSubscriber', () => {
});
});
expect(transaction).to.be.eql(await fetchNodeRaw(`transactions/${hash}`));
}).timeout(80_000);
});

// TODO: enable after solving https://github.com/aeternity/ae_mdw/issues/1336
it.skip('subscribes for micro block', async () => {
Expand All @@ -153,7 +153,7 @@ describe('MiddlewareSubscriber', () => {
}),
]);
expect(microBlock).to.be.eql(await fetchNodeRaw(`micro-blocks/hash/${blockHash}/header`));
}).timeout(80_000);
});

// TODO: enable after solving https://github.com/aeternity/ae_mdw/issues/1336
it.skip('subscribes simultaneously for micro block', async () => {
Expand All @@ -177,5 +177,5 @@ describe('MiddlewareSubscriber', () => {
]);
expect(transaction).to.be.eql(await fetchNodeRaw(`transactions/${hash}`));
expect(microBlock).to.be.eql(await fetchNodeRaw(`micro-blocks/hash/${blockHash}/header`));
}).timeout(80_000);
});
});
Loading

0 comments on commit 8cf3b9f

Please sign in to comment.