Skip to content

Commit

Permalink
Merge pull request #1547 from aeternity/release/v1.1.2
Browse files Browse the repository at this point in the history
Release v1.2.0
  • Loading branch information
davidyuk authored Apr 24, 2024
2 parents 142b6ab + 61c4f45 commit cea17b1
Show file tree
Hide file tree
Showing 13 changed files with 283 additions and 280 deletions.
4 changes: 2 additions & 2 deletions backend/package-lock.json

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

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aepp-base-backend",
"version": "1.1.1",
"version": "1.2.0",
"scripts": {
"test": "mocha 'src/*.tests.js'",
"start": "node src/main.js"
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.aeternity.base" version="1.1.1" android-versionCode="10007" ios-CFBundleVersion="1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.aeternity.base" version="1.2.0" android-versionCode="10007" ios-CFBundleVersion="1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Base æpp</name>
<author href="https://aeternity.com">
aeternity developers
Expand Down
456 changes: 221 additions & 235 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aepp-base",
"version": "1.1.1",
"version": "1.2.0",
"author": "Sascha Hanse <[email protected]>",
"private": true,
"scripts": {
Expand All @@ -19,6 +19,7 @@
},
"dependencies": {
"@aeternity/aepp-sdk": "^11.0.1",
"@aeternity/aepp-sdk-next": "npm:@aeternity/aepp-sdk@^13.3.2",
"@aeternity/bip39": "^0.1.0",
"@aeternity/hd-wallet": "^0.2.0",
"@aeternity/ledger-app-api": "^0.2.2",
Expand Down Expand Up @@ -54,7 +55,6 @@
"workbox-precaching": "^7.0.0"
},
"devDependencies": {
"@aeternity/aepp-sdk-next": "npm:@aeternity/aepp-sdk@^13.2.2",
"@babel/eslint-parser": "^7.23.3",
"@babel/plugin-syntax-import-attributes": "^7.23.3",
"@frsource/cypress-plugin-visual-regression-diff": "^3.3.10",
Expand Down
19 changes: 15 additions & 4 deletions src/lib/networksRegistry.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
const mainNetwork = {
name: 'Iris-net',
name: `${Date.now() < 1715072400000 ? 'Iris' : 'Ceres'}-net`,
url: 'https://mainnet.aeternity.io',
middlewareUrl: 'https://mainnet.aeternity.io/mdw',
explorerUrl: 'https://aescan.io',
};

const testNetwork = {
name: 'Testnet',
name: `Testnet${Date.now() < 1713947400000 ? ' (Iris)' : ''}`,
url: 'https://testnet.aeternity.io',
middlewareUrl: 'https://testnet.aeternity.io/mdw',
explorerUrl: 'https://testnet.aescan.io',
};

// Source https://forum.aeternity.com/t/the-proposed-changes-in-ceres-protocol/12056/33
const testCeresNetworkHideAt = new Date('2024-04-30');
const testCeresNetwork = {
name: `Testnet Ceres (till ${testCeresNetworkHideAt.toLocaleDateString()})`,
url: 'https://next.aeternity.io',
middlewareUrl: 'https://next.aeternity.io:8443',
explorerUrl: 'https://explorer.ceres.aepps.com',
};

const envNetwork = {
name: process.env.VUE_APP_NETWORK_NAME,
url: process.env.VUE_APP_NODE_URL,
Expand All @@ -24,8 +33,10 @@ const networks = (() => {
return [window.overrideNetwork];
}
if (envNetwork.name) return [envNetwork];
if (process.env.NODE_ENV === 'production') return [mainNetwork, testNetwork];
return [testNetwork, mainNetwork];
const list = process.env.NODE_ENV === 'production'
? [mainNetwork, testNetwork] : [testNetwork, mainNetwork];
if (Date.now() < testCeresNetworkHideAt) list.push(testCeresNetwork);
return list;
})();

export default Object.freeze(networks.map(Object.freeze));
2 changes: 1 addition & 1 deletion src/pages/mobile/AppBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
:title="url"
:scrolling="$globals.IS_IOS && 'no'"
importance="high"
sandbox="allow-scripts allow-same-origin allow-forms"
sandbox="allow-scripts allow-same-origin allow-forms allow-modals"
allow="camera; microphone"
@load="loading = false"
/>
Expand Down
57 changes: 26 additions & 31 deletions src/store/modules/accounts/hdWallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { pick } from 'lodash-es';
import Vue from 'vue';
import { generateMnemonic, mnemonicToSeed } from '@aeternity/bip39';
import {
Crypto, TxBuilder, TxBuilderHelper, SCHEMA,
} from '@aeternity/aepp-sdk';
buildTx, unpackTx, Tag, encode, decode, Encoding, sign,
} from '@aeternity/aepp-sdk-next';
import BigNumber from 'bignumber.js';
import { MAGNITUDE } from '../../../lib/constants';
import {
Expand Down Expand Up @@ -231,29 +231,34 @@ export default {
},

signWithoutConfirmation({ rootGetters }, data) {
return Crypto.sign(data, rootGetters['accounts/active'].source.secretKey);
return sign(data, rootGetters['accounts/active'].source.secretKey);
},

async confirmRawDataSigning({ dispatch }, data) {
await dispatch('modals/open', { name: 'confirmSign', data }, { root: true });
return data;
},

async confirmTxSigning({ dispatch }, txBinary) {
async confirmTxSigning({ dispatch }, txEncoded) {
let txObject;
try {
txObject = TxBuilder.unpackTx(txBinary, true).tx;
txObject = unpackTx(txEncoded);
} catch (e) {
return dispatch('confirmRawDataSigning', txBinary);
return encode(
await dispatch('confirmRawDataSigning', decode(txEncoded)),
Encoding.Transaction,
);
}

const SUPPORTED_TX_TYPES = [
SCHEMA.TX_TYPE.spend, SCHEMA.TX_TYPE.contractCreate, SCHEMA.TX_TYPE.contractCall,
SCHEMA.TX_TYPE.namePreClaim, SCHEMA.TX_TYPE.nameClaim, SCHEMA.TX_TYPE.nameUpdate,
SCHEMA.TX_TYPE.nameTransfer,
const SupportedTags = [
Tag.SpendTx, Tag.ContractCreateTx, Tag.ContractCallTx, Tag.NamePreclaimTx, Tag.NameClaimTx,
Tag.NameUpdateTx, Tag.NameTransferTx,
];
if (!SUPPORTED_TX_TYPES.includes(SCHEMA.OBJECT_ID_TX_TYPE[txObject.tag])) {
return dispatch('confirmRawDataSigning', txBinary);
if (!SupportedTags.includes(txObject.tag)) {
return encode(
await dispatch('confirmRawDataSigning', decode(txEncoded)),
Encoding.Transaction,
);
}

const format = (value) => BigNumber(value).shiftedBy(-MAGNITUDE);
Expand All @@ -263,26 +268,16 @@ export default {
...txObject,
amount: txObject.amount && format(txObject.amount),
fee: format(txObject.fee),
minFee: format(
TxBuilder.calculateFee(
0,
SCHEMA.OBJECT_ID_TX_TYPE[txObject.tag],
{ gas: txObject.gas, params: txObject, vsn: txObject.VSN },
),
),
minFee: format(unpackTx(buildTx({ ...txObject, fee: undefined })).fee),
nameFee: txObject.nameFee && format(txObject.nameFee),
},
};

return TxBuilder.buildTx(
{
...txObject,
fee: (await dispatch('modals/open', confirmProps, { root: true }))
.shiftedBy(MAGNITUDE),
},
SCHEMA.OBJECT_ID_TX_TYPE[txObject.tag],
{ vsn: txObject.VSN },
).rlpEncoded;
return buildTx({
...txObject,
fee: (await dispatch('modals/open', confirmProps, { root: true }))
.shiftedBy(MAGNITUDE),
});
},

async sign({ dispatch }, data) {
Expand All @@ -291,12 +286,12 @@ export default {
},

async signTransaction({ dispatch, rootState: { sdk } }, txBase64) {
const encodedTx = await dispatch('confirmTxSigning', TxBuilderHelper.decode(txBase64, 'tx'));
const encodedTx = await dispatch('confirmTxSigning', txBase64);
const signature = await dispatch(
'signWithoutConfirmation',
Buffer.concat([Buffer.from(sdk.getNetworkId()), Buffer.from(encodedTx)]),
Buffer.concat([Buffer.from(sdk.getNetworkId()), decode(encodedTx)]),
);
return TxBuilder.buildTx({ encodedTx, signatures: [signature] }, SCHEMA.TX_TYPE.signed).tx;
return buildTx({ tag: Tag.SignedTx, encodedTx, signatures: [signature] });
},
},
};
15 changes: 13 additions & 2 deletions src/store/plugins/initSdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default (store) => {
Ae.compose(ChainNode, Transaction, Contract, Aens, WalletRPC, { methods })({
nodes: [{
name: network.name,
instance: await Node({ url: network.url }),
instance: await Node({ url: network.url, ignoreVersion: true }),
}],
name: 'Base Aepp',
onConnection: acceptCb,
Expand Down Expand Up @@ -127,8 +127,19 @@ export default (store) => {
delete spec.paths['/names/pointees/{id}'];
return genSwaggerClient(specUrl, { spec });
})(),
genSwaggerClient(`${network.middlewareUrl}/v2/api`),
// TODO: replace with `genSwaggerClient(`${network.middlewareUrl}/v2/api`)`
// after removing next.aeternity.io
(async () => {
const specUrl = `${network.middlewareUrl}/v2/api`;
const spec = await fetchJson(specUrl);
if (network.middlewareUrl === 'https://next.aeternity.io:8443') {
spec.servers[0].url = spec.servers[0].url.replace('/mdw', '');
}
return genSwaggerClient(specUrl, { spec });
})(),
]);
// TODO: remove after updating sdk
sdk.Ae.defaults.verify = false;
sdk.selectNode(network.name);
sdk.middleware = middleware;
sdk.middleware2 = middleware2;
Expand Down
Binary file modified tests/e2e/specs/browser/__image_snapshots__/Browser opens #0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/e2e/specs/transfer/sign-transaction.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Sign transaction', () => {
const recipientId = 'ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688';
const name = 'test123test.chain';
const nameId = 'nm_2sFnPHi5ziAqhdApSpRBsYdomCahtmk3YGNZKYUTtUNpVSMccC';
const nameFee = '1000000000000000000000';
const nameFee = '10000000000000000000';
const contractId = 'ct_TCQVoset7Y4qEyV5tgEAJAqa2Foz8J1EXqoGpq3fB6dWH5roe';
const pointers = [
{ key: 'account_pubkey', id: accountId },
Expand Down

0 comments on commit cea17b1

Please sign in to comment.