Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update sdk-next to 14 #1579

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = {
'vue/multi-word-component-names': 'off',
'vue/max-attributes-per-line': 'off',
'vue/html-self-closing': 'off',
'vue/html-closing-bracket-newline': 'off',
'vue/html-indent': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vuejs-accessibility/no-autofocus': 'off',
Expand Down
79 changes: 39 additions & 40 deletions docker-compose/init-state.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import {
Node,
AeSdk,
MemoryAccount,
generateSaveHDWalletFromSeed,
getSaveHDWalletAccounts,
AccountMnemonicFactory,
encode,
Encoding,
Name,
} from '@aeternity/aepp-sdk-next';
import { mnemonicToSeed } from '@aeternity/bip39';

// TODO: remove after merging https://github.com/aeternity/ae_mdw/issues/1758
try {
Expand All @@ -27,22 +26,17 @@ await (async function rollbackToFirstBlock() {
if (status !== 200) throw new Error(`Unexpected status code: ${status}`);
})();

const onNode = new Node('http://localhost:3013');
const aeSdk = new AeSdk({
nodes: [{ name: 'testnet', instance: new Node('http://localhost:3013') }],
accounts: [
new MemoryAccount(
'9ebd7beda0c79af72a42ece3821a56eff16359b6df376cf049aee995565f022f840c974b97164776454ba119d84edc4d6058a8dec92b6edc578ab2d30b4c4200',
),
],
nodes: [{ name: 'testnet', instance: onNode }],
accounts: [new MemoryAccount('sk_2CuofqWZHrABCrM7GY95YSQn8PyFvKQadnvFnpwhjUnDCFAWmf')],
});

const seed = mnemonicToSeed(
const factory = new AccountMnemonicFactory(
'cross cat upper state flame wire inner betray almost party agree endorse',
);
const wallet = generateSaveHDWalletFromSeed(seed, '');
const [{ secretKey }, { secretKey: secretKey2 }] = getSaveHDWalletAccounts(wallet, '', 2);
const account1 = new MemoryAccount(secretKey);
const account2 = new MemoryAccount(secretKey2);
const account1 = await factory.initialize(0);
const account2 = await factory.initialize(1);

await aeSdk.spend(200e18, account1.address);
await aeSdk.spend(100e18, account2.address);
Expand All @@ -56,35 +50,40 @@ await (async function prepareTransactionHistory() {
})();

await (async function prepareNames() {
await aeSdk.aensClaim('engine.chain', 0);
await aeSdk.aensBid('engine.chain', 60e18, { onAccount: account1 });
await aeSdk.aensBid('engine.chain', 65e18);
await aeSdk.aensClaim('visual.chain', 0);
await aeSdk.aensBid('visual.chain', 60e18, { onAccount: account1 });
await aeSdk.aensClaim('inspector.chain', 0);
await aeSdk.aensClaim('мир.chain', 0);
await aeSdk.aensClaim('understanding.chain', 0, { onAccount: account1 });
await aeSdk.aensClaim('entertainment.chain', 0, { onAccount: account2 });
await aeSdk.aensUpdate(
'entertainment.chain',
{
account_pubkey: account2.address,
contract_pubkey: account1.address.replace('ak_', 'ct_'),
'second account': account1.address,
raw: encode(Buffer.from('test'), Encoding.Bytearray),
},
{ onAccount: account2 },
);
const engine = new Name('engine.chain', aeSdk.getContext());
await engine.claim();
await engine.bid(60e18, { onAccount: account1 });
await engine.bid(65e18);

const visual = new Name('visual.chain', aeSdk.getContext());
await visual.claim();
await visual.bid(60e18, { onAccount: account1 });

await new Name('inspector.chain', aeSdk.getContext()).claim();

await new Name('мир.chain', aeSdk.getContext()).claim();

await new Name('understanding.chain', { onNode, onAccount: account1 }).claim();

const entertainment = new Name('entertainment.chain', { onNode, onAccount: account2 });
await entertainment.claim();
await entertainment.update({
account_pubkey: account2.address,
contract_pubkey: account1.address.replace('ak_', 'ct_'),
'second account': account1.address,
raw: encode(Buffer.from('test'), Encoding.Bytearray),
});
console.log('Names ready');
})();

await (async function wallet2() {
const seed = mnemonicToSeed('sun dish cousin double youth year path fix away pig spring upset');
const wallet = generateSaveHDWalletFromSeed(seed, '');
const [{ secretKey }, { publicKey: publicKey2 }] = getSaveHDWalletAccounts(wallet, '', 2);
const acc = new MemoryAccount(secretKey);
await aeSdk.spend(100e18, acc.address);
await aeSdk.spend(100e18, publicKey2);
await aeSdk.aensClaim('investigation.chain', 0, { onAccount: acc });
const factory = new AccountMnemonicFactory(
'sun dish cousin double youth year path fix away pig spring upset',
);
const acc1 = await factory.initialize(0);
const acc2 = await factory.initialize(1);
await aeSdk.spend(100e18, acc1.address);
await aeSdk.spend(100e18, acc2.address);
await new Name('investigation.chain', { onNode, onAccount: acc1 }).claim();
console.log('Wallet 2 ready');
})();
Loading
Loading