Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • hive/wax
1 result
Show changes
Commits on Source (8)
Showing
with 1143 additions and 303 deletions
......@@ -79,6 +79,7 @@ wax_wasm_proto_tsc_generation:
when: always
paths:
- "${DIST_DIR}/*.tgz" # Built package
- "${SOURCE_DIR}/packages/*/dist"
- "${REPLACE_FILE_PATH}" # Modified README
- "${CI_PROJECT_DIR}/ts/wasm/lib/proto" # For documentation generator
- "${CI_PROJECT_DIR}/ts/wasm/lib/build_wasm" # For documentation generator
......
......@@ -269,6 +269,16 @@ private_key_data foundation::cpp_generate_private_key(const std::string& account
);
}
std::string foundation::cpp_convert_raw_private_key_to_wif(const std::string& hexData)
{
FC_ASSERT(hexData.size() == 64 && "Expected hex string pointing 32 byte buffer");
fc::sha256 sharedSecret(hexData);
return fc::ecc::private_key::regenerate(sharedSecret).key_to_wif();
}
brain_key_data foundation::cpp_suggest_brain_key()
{
return cpp::safe_exception_wrapper(
......
......@@ -15,8 +15,11 @@ public:
result cpp_calculate_public_key(const std::string& wif);
result cpp_generate_private_key();
private_key_data cpp_generate_private_key(const std::string& account, const std::string& role, const std::string& password);
/** Allows to convert 32 bytes data buffer expressed as hex string (pointing private key secret) into private key encoded as WIF format.
*/
std::string cpp_convert_raw_private_key_to_wif(const std::string& hexData);
brain_key_data cpp_suggest_brain_key();
/** Returns map of hive::protocol constants in form:
......
......@@ -187,54 +187,6 @@ const manaTime = await chain.calculateManabarFullRegenerationTimeForAccount("ini
console.info(manaTime); // Date
```
#### Extend API interface and call custom endpoints
In this example we will extend the base Wax endpoints and create our classes with validators
in order to use the [transaction_status_api.find_transaction](https://developers.hive.io/apidefinitions/#transaction_status_api.find_transaction) API:
```ts
import { IsHexadecimal, IsDateString, IsString } from 'class-validator';
import { createHiveChain, TWaxExtended } from '@hiveio/wax';
const chain = await createHiveChain();
// https://developers.hive.io/apidefinitions/#transaction_status_api.find_transaction-parameter_json
// Create a request class with validators that will require a valid input from the end user
class FindTransactionRequest {
@IsHexadecimal()
public transaction_id!: string;
@IsDateString()
public expiration!: string;
}
// https://developers.hive.io/apidefinitions/#transaction_status_api.find_transaction-expected_response_json
// Create a response class with validators that will require a valid output from the remote API
class FindTransactionResponse {
@IsString()
public status!: 'unknown' | string;
}
// Create the proper API structure
const ExtendedApi = {
transaction_status_api: { // API
find_transaction: { // Method
params: FindTransactionRequest, // params is our request
result: FindTransactionResponse // result is out response
}
}
};
const extended: TWaxExtended<typeof ExtendedApi> = chain.extend(ExtendedApi);
// Call the transaction_status_api API using our extended interface
const result = await extended.api.transaction_status_api.find_transaction({
transaction_id: "0000000000000000000000000000000000000000",
expiration: "2016-03-24T18:00:21"
});
console.info(result); // { status: 'unknown' }
```
#### Extend API interface using interfaces only and call custom endpoints
In this example we will extend the base Wax endpoints without creating any validators.
......@@ -275,42 +227,6 @@ const result = await extended.api.transaction_status_api.find_transaction({
console.info(result); // { status: 'unknown' }
```
#### Extend REST API interface and call custom endpoints
In this example we will extend REST API Wax endpoints and create our classes with validators
in order to use the [hafah_endpoints.get_transaction](https://api.syncad.com/?urls.primaryName=HAfAH#/Transactions/hafah_endpoints.get_transaction) API:
```ts
import { IsHexadecimal } from 'class-validator';
import { createHiveChain, TWaxRestExtended } from '@hiveio/wax';
const chain = await createHiveChain();
class TransactionByIdRequest {
@IsHexadecimal()
public transactionId!: string;
}
// Create the proper API structure
const ExtendedRestApi = {
'hafah-api': { // API type - structure-like - pushed to the query path during call
transactions: { // method name - also pushed to the query path during call
byId: { // next query path to be added. It will be replaced though due to the urlPath property defined
params: TransactionByIdRequest, // params is our request
result: Number, // result is our response (Number is a NumberConstructor - we cannot use number as a type in this context, so we pass NumberConstructor as a value)
urlPath: "{transactionId}" // url that will replace `byId`. We have `{}` format syntax here, so it means data from `params` matching given property names will be replaced in braces
}
}
}
};
const extended: TWaxRestExtended<typeof ExtendedRestApi> = chain.extendRest(ExtendedRestApi);
// Call the REST API using our extended interface
const result = await await extended.restApi['hafah-api'].transactions.byId({ transactionId: "954f6de36e6715d128fa8eb5a053fc254b05ded0" });
console.info(result); // URL response from "https://api.syncad.com/hafah-api/transactions/954f6de36e6715d128fa8eb5a053fc254b05ded0"
```
#### Extend REST API interface using interfaces only and call custom endpoints
In this example we will extend the REST API Wax endpoints without creating any validators.
......
......@@ -71,8 +71,6 @@
"@types/express": "^5.0.0",
"@types/express-http-proxy": "^1.6.6",
"@types/node": "^22.10.6",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"cors": "^2.8.5",
"express": "^4.21.2",
"express-http-proxy": "^2.1.1",
......@@ -81,7 +79,7 @@
"npm-run-all": "^4.1.5",
"playwright": "catalog:playwright-toolset",
"protobufjs": "catalog:proto-toolset",
"reflect-metadata": "^0.1.13",
"reflect-metadata": "^0.2.2",
"rimraf": "^6.0.1",
"rollup": "catalog:rollup-toolset",
"rollup-plugin-copy": "catalog:rollup-toolset",
......@@ -106,7 +104,7 @@
"path": [
"./wasm/dist/bundle"
],
"limit": "5500 kB",
"limit": "5400 kB",
"brotli": false
}
],
......
# Wax packages
This Wax subdirectory is responsible for maintaining Wax "extensions", e.g. signers using the pnpm's workspaces strategy
## Building
1. Install dependencies using `pnpm install` - this will automatically install dependencies for all of the package directories from this directory.
2. Build all the packages using `pnpm run build`
3. Now you can either pack: `pnpm run pack` or publish: `pnpm publish -r`. Note: All of the packages will be saved under [`dist`](./dist) directory
# @hiveio/wax-signers-keychain
Wax signer library extending transaction signing possibilities by a 3rd party Web-only extension - Keychain
## Prerequisites
- Configured [@hiveio/wax](https://www.npmjs.com/package/@hiveio/wax) library. Wax Keychain signer is an extension the base Wax library, extending its signing possibilities by using 3rd party wallet
- Configured [Keychain browser extension](https://hive-keychain.com/) with imported keys
## Example usage
```ts
import { createHiveChain } from "@hiveio/wax";
import KeychainProvider from "@hiveio/wax-signers-keychain";
const chain = await createHiveChain();
const provider = KeychainProvider.for("myaccount", "active");
// Create a transaction using the Wax Hive chain instance
const tx = await chain.createTransaction();
// Perform some operations, e.g. push the vote operation:
tx.pushOperation({
vote: {
voter: "alice",
author: "bob",
permlink: "example-post",
weight: 10000
}
});
// Wait for the keychain to sign the transaction
await tx.sign(provider);
// broadcast the transaction
await chain.broadcast(tx);
```
## License
See license in [LICENSE.md](LICENSE.md) file
{
"name": "@hiveio/wax-signers-keychain",
"version": "0.0.0-Run-Prepack",
"description": "Wax signer library extending transaction signing possibilities by a 3rd party Web-only extension - Keychain",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"private": false,
"scripts": {
"build": "tsc",
"prepack": "jq --argfile source ../../package.json '.version = $source.version | .publishConfig.registry = $source.publishConfig.registry | .publishConfig.tag = $source.publishConfig.tag' package.json > package.json.tmp && mv package.json.tmp package.json"
},
"devDependencies": {
"typescript": "catalog:typescript-toolset"
},
"dependencies": {
"@hiveio/wax": "workspace:../..",
"keychain-sdk": "^0.8.5"
},
"files": [
"dist/index.d.ts",
"dist/index.js",
"README.md",
"LICENSE.md"
],
"license": "SEE LICENSE IN LICENSE.md",
"keywords": [
"wax",
"blockchain",
"hive"
],
"repository": {
"type": "git",
"url": "https://gitlab.syncad.com/hive/wax.git"
},
"publishConfig": {
"registry": "https://RegistryPlaceholder",
"tag": "DistTagPlaceholder"
}
}
\ No newline at end of file
import type { IOnlineSignatureProvider, ITransaction, TAccountName, TRole } from "@hiveio/wax";
import { KeychainKeyTypes, KeychainSDK } from "keychain-sdk";
const mapRoles: Record<TRole, KeychainKeyTypes | undefined> = {
active: KeychainKeyTypes.active,
posting: KeychainKeyTypes.posting,
owner: undefined,
memo: KeychainKeyTypes.memo
};
// We do not extend from WaxError to avoid runtime dependencies, such as: /vite or /web - without it we can import only types
export class WaxKeychainProviderError extends Error {}
/**
* Wax transaction signature provider using the Keychain SDK.
*
* @example
* ```
* const provider = KeychainProvider.for("myaccount", "active");
*
* // Create a transaction using the Wax Hive chain instance
* const tx = await chain.createTransaction();
*
* // Perform some operations, e.g. pushing operations...
*
* // Sign the transaction
* await tx.sign(provider);
*
* // broadcast
* await chain.broadcast(tx);
* ```
*/
class KeychainProvider implements IOnlineSignatureProvider {
private readonly role: KeychainKeyTypes;
private static keychain: KeychainSDK;
private constructor(
private readonly accountName: TAccountName,
role: TRole
) {
if (!mapRoles[role])
throw new Error(`Role ${role} is not supported by the Wax signature provider: ${KeychainProvider.name}`);
if(!KeychainProvider.keychain)
KeychainProvider.keychain = new KeychainSDK(window);
this.role = mapRoles[role];
}
public static for(accountName: TAccountName, role: TRole): KeychainProvider {
return new KeychainProvider(accountName, role);
}
public async signTransaction(transaction: ITransaction): Promise<void> {
const data = await KeychainProvider.keychain.signTx({
method: this.role,
username: this.accountName,
tx: JSON.parse(transaction.toLegacyApi())
});
for(const sig of data.result.signatures)
transaction.sign(sig);
}
}
export default KeychainProvider;
{
"extends": "../../npm-common-config/ts-common/tsconfig.base.json",
"compilerOptions": {
"rootDir": "./src",
"baseUrl": ".",
"outDir": "./dist",
"incremental": true,
"tsBuildInfoFile": "./dist/.tsbuildinfo",
"skipLibCheck": true
},
"include": [
"./src"
]
}
\ No newline at end of file
# @hiveio/wax-signers-peakvault
Wax signer library extending transaction signing possibilities by a 3rd party Web-only extension - Peak Vault
## Prerequisites
- Configured [@hiveio/wax](https://www.npmjs.com/package/@hiveio/wax) library. Wax Peak Vault signer is an extension the base Wax library, extending its signing possibilities by using 3rd party wallet
- Configured [Peak Vault browser extension](https://vault.peakd.com/peakvault/releases.html) with imported keys
## Example usage
```ts
import { createHiveChain } from "@hiveio/wax";
import PeakVaultProvider from "@hiveio/wax-signers-peakvault";
const chain = await createHiveChain();
const provider = PeakVaultProvider.for("myaccount", "active");
// Create a transaction using the Wax Hive chain instance
const tx = await chain.createTransaction();
// Perform some operations, e.g. push the vote operation:
tx.pushOperation({
vote: {
voter: "alice",
author: "bob",
permlink: "example-post",
weight: 10000
}
});
// Wait for the keychain to sign the transaction
await tx.sign(provider);
// broadcast the transaction
await chain.broadcast(tx);
```
## License
See license in [LICENSE.md](LICENSE.md) file
{
"name": "@hiveio/wax-signers-peakvault",
"version": "0.0.0-Run-Prepack",
"description": "Wax signer library extending transaction signing possibilities by a 3rd party Web-only extension - Peak Vault",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"private": false,
"scripts": {
"build": "tsc",
"prepack": "jq --argfile source ../../package.json '.version = $source.version | .publishConfig.registry = $source.publishConfig.registry | .publishConfig.tag = $source.publishConfig.tag' package.json > package.json.tmp && mv package.json.tmp package.json"
},
"devDependencies": {
"typescript": "catalog:typescript-toolset"
},
"dependencies": {
"@hiveio/wax": "workspace:../..",
"@peakd/hive-wallet-sdk": "^0.2.3"
},
"files": [
"dist/index.d.ts",
"dist/index.js",
"README.md",
"LICENSE.md"
],
"license": "SEE LICENSE IN LICENSE.md",
"keywords": [
"wax",
"blockchain",
"hive"
],
"repository": {
"type": "git",
"url": "https://gitlab.syncad.com/hive/wax.git"
},
"publishConfig": {
"registry": "https://RegistryPlaceholder",
"tag": "DistTagPlaceholder"
}
}
\ No newline at end of file
import type { IOnlineSignatureProvider, ITransaction, TAccountName, TRole } from "@hiveio/wax";
import { getWallet } from '@peakd/hive-wallet-sdk'
// @peakd/hive-wallet-sdk fails to provide this type import
type KeyRole = Parameters<typeof PeakVaultProvider['peakVaultWallet']['signTx']>[2];
const mapRoles: Record<TRole, KeyRole | undefined> = {
active: 'active',
posting: 'posting',
owner: undefined,
memo: 'memo'
};
const PEAKVAULT_WALLET_ID: Parameters<typeof getWallet>[0] = 'peakvault';
// We do not extend from WaxError to avoid runtime dependencies, such as: /vite or /web - without it we can import only types
export class WaxPeakVaultProviderError extends Error {}
/**
* Wax transaction signature provider using the Peak Vault.
*
* @example
* ```
* const provider = PeakVaultProvider.for("myaccount", "active");
*
* // Create a transaction using the Wax Hive chain instance
* const tx = await chain.createTransaction();
*
* // Perform some operations, e.g. pushing operations...
*
* // Sign the transaction
* await tx.sign(provider);
*
* // broadcast
* await chain.broadcast(tx);
* ```
*/
class PeakVaultProvider implements IOnlineSignatureProvider {
private readonly role: KeyRole;
private static peakVaultWallet: Awaited<ReturnType<typeof getWallet>>;
private constructor(
private readonly accountName: TAccountName,
role: TRole
) {
if (!mapRoles[role])
throw new Error(`Role ${role} is not supported by the Wax signature provider: ${PeakVaultProvider.name}`);
this.role = mapRoles[role];
}
public static for(accountName: TAccountName, role: TRole): PeakVaultProvider {
return new PeakVaultProvider(accountName, role);
}
public async signTransaction(transaction: ITransaction): Promise<void> {
if (!PeakVaultProvider.peakVaultWallet)
PeakVaultProvider.peakVaultWallet = await getWallet(PEAKVAULT_WALLET_ID);
const data = await PeakVaultProvider.peakVaultWallet.signTx(this.accountName, JSON.parse(transaction.toLegacyApi()), this.role);
for(const sig of data.result.signatures)
transaction.sign(sig);
}
}
export default PeakVaultProvider;
{
"extends": "../../npm-common-config/ts-common/tsconfig.base.json",
"compilerOptions": {
"rootDir": "./src",
"baseUrl": ".",
"outDir": "./dist",
"incremental": true,
"tsBuildInfoFile": "./dist/.tsbuildinfo",
"skipLibCheck": true
},
"include": [
"./src"
]
}
\ No newline at end of file
This diff is collapsed.
......@@ -21,10 +21,6 @@ export default [
}),
replace({
values: {
// Make sure we do not include `process` in the code:
'process': null,
'process.env': null,
'process.env.REFLECT_METADATA_USE_MAP_POLYFILL': null, // Bundled dependency - reflect-metadata - uses this - we do not need it
// Hardcode package name and version for later use in the code:
'process.env.npm_package_name': `"${process.env.npm_package_name}"`,
'process.env.npm_package_version': `"${process.env.npm_package_version}"`
......
......@@ -283,7 +283,7 @@ test.describe('Wax object interface formatters tests', () => {
test('Should be able to retrieve account from the API and format it using default formatter from the hive chain interface', async({ waxTest }) => {
const retVal = await waxTest(async({ chain }) => {
const response = await chain.api.database_api.find_accounts({ accounts: [ "initminer" ] });
const response = await chain.api.database_api.find_accounts({ accounts: [ "initminer" ], delayed_votes_active: true });
return chain.formatter.extend({ asset: { displayAsNai: false, appendTokenName: true, formatAmount: true, locales: "en-US" } }).format(response.accounts[0]);
});
......
......@@ -2,7 +2,6 @@ import { expect } from '@playwright/test';
import { test } from '../assets/jest-helper';
import { protoVoteOp, recoverAccountTransaction, requiredActiveAuthorityTransaction, requiredOwnerAuthorityTransaction, signatureTransaction } from "../assets/data.proto-protocol";
import { IsArray, IsObject, IsString } from 'class-validator';
const HIVE_BLOCK_INTERVAL = 3 * 1000; // 3 seconds
......@@ -33,75 +32,6 @@ test.describe('Wax object interface chain tests', () => {
expect(retVal.digest).toBe('205c79e3d17211882b1a2ba8640ff208413d68cabdca892cf47e9a6ad46e63a1');
});
test('Should be able to transmit article transaction using hive chain interface', async ({ waxTest }) => {
const retVal = await waxTest(async({ beekeeper, chain, wax }) => {
// Create wallet:
const session = beekeeper.createSession("salt");
const { wallet } = await session.createWallet("w0");
await wallet.importKey('5JkFnXrLM2ap9t3AmAxBJvQHF7xSKtnTrCTginQCkhzU5S7ecPT');
const tx = chain.createTransactionWithTaPoS("04c1c7a566fc0da66aee465714acee7346b48ac2", "2023-08-01T15:38:48");
tx.pushOperation(new wax.BlogPostOperation({
author: "mee",
body: "how r u",
category: "test",
title: "about you",
permlink: "permlink1",
percentHbd: 0,
maxAcceptedPayout: chain.hbdSatoshis(0)
}));
tx.sign(wallet, "STM5RqVBAVNp5ufMCetQtvLGLJo7unX9nyCBMMrTXRWQ9i1Zzzizh");
console.log(tx.toApi());
return new wax.BroadcastTransactionRequest(tx);
});
retVal.trx.signatures.splice(0, 1); // We do not want to test signing here which will change due to json_metadata app version and name values
expect(retVal).toStrictEqual({
max_block_age: -1,
trx: {
operations: [
{
type: "comment_operation",
value: {
parent_author: "",
parent_permlink: "test",
author: "mee",
permlink: "permlink1",
title: "about you",
body: "how r u",
json_metadata: `{\"format\":\"markdown+html\",\"app\":\"${process.env.npm_package_name}/${process.env.npm_package_version}\"}`
}
},
{
type: "comment_options_operation",
value: {
author: "mee",
permlink: "permlink1",
max_accepted_payout: {
amount: "0",
precision: 3,
nai: "@@000000013"
},
percent_hbd: 0,
allow_votes: true,
allow_curation_rewards: true
}
}
],
extensions: [],
signatures: [],
ref_block_num: 51109,
ref_block_prefix: 2785934438,
expiration: '2023-08-01T15:38:48'
}
});
});
test('Should be able to perform example API call', async ({ waxTest }) => {
const retVal = await waxTest(async({ chain }) => {
// https://developers.hive.io/apidefinitions/#account_by_key_api.get_key_references
......@@ -169,47 +99,6 @@ test.describe('Wax object interface chain tests', () => {
expect(retVal).toStrictEqual({ args: {}, ret: [] });
});
test('Should be able to extend hive chain and validate properties interface by custom definitions', async ({}, testInfo) => {
class MyRequest {
@IsString()
method!: string;
}
class MyResponse {
@IsObject()
args!: {};
@IsArray()
ret!: [];
}
const { chain } = await createWaxTestFor('node', testInfo.outputDir);
const extended = chain.extend({
jsonrpc: {
get_signature: {
params: MyRequest,
result: MyResponse
}
}
});
await expect(async() => {
await extended.api.jsonrpc.get_signature(new MyRequest());
}).rejects.toBeInstanceOf(Array); // Array<ValidationError>
await expect(async() => {
const req = new MyRequest();
(req.method as any) = 10; // Force invalid type on the method
await extended.api.jsonrpc.get_signature(req); // This should throw after validating
}).rejects.toBeInstanceOf(Array); // Array<ValidationError>
const result = await extended.api.jsonrpc.get_signature({ method: "jsonrpc.get_methods" });
const expectedResult = new MyResponse();
expectedResult.args = {};
expectedResult.ret = [];
expect(result).toStrictEqual(expectedResult);
});
test('Should be able to extend hive chain interface by custom definitions using interfaces only', async ({ waxTest }) => {
const retVal = await waxTest(async({ chain }) => {
interface IMyRequest {
......@@ -237,58 +126,6 @@ test.describe('Wax object interface chain tests', () => {
expect(retVal).toStrictEqual({ args: {}, ret: [] });
});
test('Should throw when creating broadcast transaction request from unsigned transaction', async ({ waxTest }) => {
const retVal = await waxTest(async({ chain, wax }, protoVoteOp) => {
const tx = chain.createTransactionWithTaPoS("04c1c7a566fc0da66aee465714acee7346b48ac2", "2023-08-01T15:38:48");
tx.pushOperation(protoVoteOp).transaction;
try {
new wax.BroadcastTransactionRequest(tx);
return false;
} catch {
return true;
}
}, protoVoteOp);
expect(retVal).toBeTruthy();
});
test('Should be able to transmit protobuf transaction using hive chain interface', async ({ waxTest }) => {
const retVal = await waxTest(async({ beekeeper, chain, wax }, protoVoteOp) => {
// Create wallet:
const session = beekeeper.createSession("salt");
const { wallet } = await session.createWallet("w0");
await wallet.importKey('5JkFnXrLM2ap9t3AmAxBJvQHF7xSKtnTrCTginQCkhzU5S7ecPT');
const tx = chain.createTransactionWithTaPoS("04c1c7a566fc0da66aee465714acee7346b48ac2", "2023-08-01T15:38:48");
tx.pushOperation(protoVoteOp).sign(wallet, "STM5RqVBAVNp5ufMCetQtvLGLJo7unX9nyCBMMrTXRWQ9i1Zzzizh");
return new wax.BroadcastTransactionRequest(tx);
}, protoVoteOp);
expect(retVal).toStrictEqual({
max_block_age: -1,
trx: {
operations: [ {
type: "vote_operation",
value: {
author: "c0ff33a",
permlink: "ewxhnjbj",
voter: "otom",
weight: 2200,
}
} ],
extensions: [],
signatures: [
"1f7f0c3e89e6ccef1ae156a96fb4255e619ca3a73ef3be46746b4b40a66cc4252070eb313cc6308bbee39a0a9fc38ef99137ead3c9b003584c0a1b8f5ca2ff8707"
],
ref_block_num: 51109,
ref_block_prefix: 2785934438,
expiration: '2023-08-01T15:38:48'
}
});
});
test('Should be able to calculate current manabar value using hive chain interface', async ({ waxTest }) => {
const retVal = await waxTest(async({ chain }) => {
const { current, max, percent } = chain.calculateCurrentManabarValue(
......@@ -313,7 +150,7 @@ test.describe('Wax object interface chain tests', () => {
test('Should be able to parse user manabar from API using hive chain interface', async ({ waxTest }) => {
const retVal = await waxTest(async({ chain }) => {
const { accounts: [ account ] } = await chain.api.database_api.find_accounts({
accounts: [ "initminer" ]
accounts: [ "initminer" ], delayed_votes_active: true
});
const dgpo = await chain.api.database_api.get_dynamic_global_properties({});
......
......@@ -106,7 +106,7 @@ test.describe('Wax object interface chain tests (using custom options)', () => {
test('Should be able to find accounts from hive chain interafce', async({ waxTest }) => {
const retVal = await waxTest(async({ chain }) => {
return (await chain.api.database_api.find_accounts({ accounts: ['thatcryptodave'] })).accounts[0];
return (await chain.api.database_api.find_accounts({ accounts: ['thatcryptodave'], delayed_votes_active: true })).accounts[0];
});
expect(retVal).toHaveProperty('active');
......
......@@ -16,7 +16,7 @@ test.describe('Wax base mock tests', () => {
test('Should be able to find account based on mock interface', async ({ waxTest }) => {
const retVal = await waxTest(async({ chain }) => {
const foundAccount = await chain.api.database_api.find_accounts({ accounts: ['steem'] });
const foundAccount = await chain.api.database_api.find_accounts({ accounts: ['steem'], delayed_votes_active: true });
return foundAccount;
});
......@@ -26,7 +26,7 @@ test.describe('Wax base mock tests', () => {
test('Should be able to find NONEXISTING account based on mock interface', async ({ waxTest }) => {
const retVal = await waxTest(async({ chain }, accountData) => {
const foundAccount = await chain.api.database_api.find_accounts({ accounts: ['0steem'] }); /// Intentionally use invalid name in Hive
const foundAccount = await chain.api.database_api.find_accounts({ accounts: ['0steem'], delayed_votes_active: true }); /// Intentionally use invalid name in Hive
console.log(JSON.stringify(foundAccount));
......