Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22

- name: setup yarn
run: npm install -g yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22

- name: setup yarn
run: npm install -g yarn
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22

- name: setup yarn
run: npm install -g yarn
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22

- name: setup yarn
run: npm install -g yarn
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22

- name: setup yarn
run: npm install -g yarn
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"packageManager": "yarn@3.6.3",
"private": true,
"engines": {
"node": ">=v16"
"node": ">=v22"
},
"workspaces": [
"packages/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/bodhi/src/__tests__/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ContractFactory } from 'ethers';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';

import { BodhiSigner } from '../BodhiSigner';
import { getTestUtils } from './utils';
import { getTestUtils } from '../utils';
import echoJson from './abis/Echo.json';

describe('BodhiSigner contract interaction', () => {
Expand Down
41 changes: 0 additions & 41 deletions packages/bodhi/src/__tests__/utils.ts

This file was deleted.

41 changes: 41 additions & 0 deletions packages/bodhi/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { BigNumber } from '@ethersproject/bignumber';
import { BodhiProvider } from '@acala-network/eth-providers';
import { BytesLike } from '@ethersproject/bytes';
import { KeyringPair } from '@polkadot/keyring/types';
import { WsProvider } from '@polkadot/api';
import { bufferToU8a, isBuffer, isU8a, u8aToHex } from '@polkadot/util';
import { createTestPairs } from '@polkadot/keyring';

import { BodhiSigner } from './BodhiSigner';

export const U32MAX = BigNumber.from('0xffffffff');
export const U64MAX = BigNumber.from('0xffffffffffffffff');
Expand All @@ -18,3 +24,38 @@ export const dataToString = (bytes: BytesLike): string => {

return bytes as string;
};

export const getTestUtils = async (
url = 'ws://localhost:9944',
claimDefault = true,
): Promise<{
wallets: BodhiSigner[];
pairs: KeyringPair[];
provider: BodhiProvider;
}> => {
const provider = new BodhiProvider({
provider: new WsProvider(url),
});
await provider.isReady();

const { alice } = createTestPairs();
const pairs = [alice];

const wallets: BodhiSigner[] = [];
for (const pair of pairs) {
const wallet = BodhiSigner.fromPair(provider, pair);

const isClaimed = await wallet.isClaimed();
if (!isClaimed && claimDefault) {
await wallet.claimDefaultAccount();
}

wallets.push(wallet);
}

return {
wallets,
pairs,
provider,
};
};
Loading