Skip to content

Commit 4307bcb

Browse files
committed
Merge branch 'development' into e2e-tests-added
2 parents 159a1e5 + 82de5d8 commit 4307bcb

File tree

15 files changed

+574
-785
lines changed

15 files changed

+574
-785
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
node-version: [14, 16]
17+
node-version: [16]
1818
steps:
1919
- uses: actions/checkout@v2
2020
- uses: actions/setup-node@v2

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/setup-node@v2
2626
with:
2727
cache: yarn
28-
node-version: '14'
28+
node-version: '16'
2929
- name: Install NodeJS dependencies
3030
run: yarn install --frozen-lockfile
3131
- name: Setup Golang Version

documentation/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Documentation
2+
3+
4+
* [ESLint](./eslint.md)
5+
* [E2E Tests](./e2e_tests.md)

documentation/e2e_tests.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ For example,
88

99
`./avash_avalanchejs_e2e.sh "/path/to/avash/" "/path/to/avalanchejs/"`
1010

11+
This script runs the five node script by default.
1112

1213
- New E2E tests go in the /e2e_tests/ directory.
1314

15+
Follow the steps below if you do not wish to use the five node script, but instead test against one of the nodes. You provide the PORT of the specified node.
16+
17+
## Avash
18+
19+
This option does not require executing a docker container, but it may not lead to the same results of CI, depending on the branch, version, and configuration options of the nodes executed by avash.
20+
21+
* Launch `avash`
22+
* Set env vars `AVALANCHEGO_IP`, `AVALANCHEGO_PORT` to point to one of the nodes of avash
23+
* From avalanchejs dir execute: `yarn test -i --roots e2e_tests`
24+
25+
Example workflow
26+
27+
```zsh
28+
cd /path/to/avash
29+
./avash
30+
avash> runscript scripts/five_node_staking.lua
31+
32+
# Open another terminal tab/window
33+
cd /path/to/avalanchejs
34+
AVALANCHEGO_IP=localhost AVALANCHEGO_PORT=9650 yarn test -i --roots e2e_tests
35+
```

e2e_tests/avash_avalanchejs_e2e.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,3 @@ echo killall avalanchego
6868

6969
# cleanup
7070
rm -f $fifo_fname
71-

e2e_tests/e2e_local.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

e2e_tests/e2e_local.sh

Lines changed: 0 additions & 62 deletions
This file was deleted.

e2e_tests/xchain_nomock.test.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -162,30 +162,10 @@ describe("XChain", (): void => {
162162
Matcher.toThrow,
163163
() => "couldn't unmarshal an argument"
164164
],
165-
[
166-
"exportAVAX",
167-
() =>
168-
xchain.exportAVAX(
169-
user,
170-
passwd,
171-
"C" + addrB.value.substring(1),
172-
new BN(10)
173-
),
174-
(x) => x,
175-
Matcher.toThrow,
176-
() => "couldn't unmarshal an argument"
177-
],
178165
[
179166
"import",
180167
() => xchain.import(user, passwd, addrB.value, "C"),
181168
(x) => x,
182-
Matcher.toMatch,
183-
() => /\w+/
184-
],
185-
[
186-
"importAVAX",
187-
() => xchain.importAVAX(user, passwd, addrB.value, "P"),
188-
(x) => x,
189169
Matcher.toThrow,
190170
() => "problem issuing transaction: no import inputs"
191171
],

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "avalanche",
3-
"version": "3.9.1",
3+
"version": "3.9.3",
44
"description": "Avalanche Platform JS Library",
55
"main": "dist/index.js",
66
"scripts": {
@@ -49,7 +49,7 @@
4949
"@types/create-hash": "1.2.2",
5050
"@types/hdkey": "2.0.0",
5151
"@types/jest": "27.0.2",
52-
"@types/node": "16.10.2",
52+
"@types/node": "16.11.6",
5353
"@typescript-eslint/eslint-plugin": "4.33.0",
5454
"@typescript-eslint/parser": "4.33.0",
5555
"clean-webpack-plugin": "4.0.0",
@@ -58,41 +58,41 @@
5858
"eslint-plugin-prettier": "4.0.0",
5959
"eslint-plugin-security": "1.4.0",
6060
"git-revision-webpack-plugin": "5.0.0",
61-
"html-webpack-plugin": "5.3.2",
62-
"husky": "7.0.2",
63-
"isomorphic-dompurify": "^0.15.0",
61+
"html-webpack-plugin": "5.5.0",
62+
"husky": "7.0.4",
6463
"jest": "26.6.3",
6564
"jest-mock-axios": "4.4.1",
6665
"prettier": "2.4.1",
67-
"terser-webpack-plugin": "5.1.4",
66+
"terser-webpack-plugin": "5.2.4",
6867
"ts-jest": "26.5.6",
6968
"ts-loader": "9.2.6",
7069
"typedoc": "0.22.4",
7170
"typedoc-plugin-external-module-name": "4.0.6",
72-
"typedoc-plugin-markdown": "3.11.2",
73-
"typescript": "4.4.3",
74-
"webpack": "5.51.1",
75-
"webpack-cli": "4.8.0"
71+
"typedoc-plugin-markdown": "3.11.3",
72+
"typescript": "4.4.4",
73+
"webpack": "5.58.2",
74+
"webpack-cli": "4.9.1"
7675
},
7776
"engines": {
78-
"node": ">=14.17.0"
77+
"node": ">=16.13.0"
7978
},
8079
"dependencies": {
8180
"assert": "2.0.0",
82-
"axios": "0.21.4",
81+
"axios": "0.24.0",
8382
"bech32": "2.0.0",
8483
"bip39": "3.0.4",
8584
"bn.js": "5.2.0",
8685
"buffer": "6.0.3",
8786
"create-hash": "1.2.0",
8887
"crypto-browserify": "3.12.0",
8988
"elliptic": "6.5.4",
90-
"ethers": "5.4.7",
89+
"ethers": "5.5.1",
9190
"hdkey": "2.0.1",
91+
"isomorphic-dompurify": "^0.15.0",
9292
"isomorphic-ws": "4.0.1",
9393
"store2": "2.12.0",
9494
"stream-browserify": "3.0.0",
95-
"ws": "8.2.2"
95+
"ws": "8.2.3"
9696
},
9797
"prettier": {
9898
"tabWidth": 2,

src/apis/avm/api.ts

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import {
3636
CreateAddressParams,
3737
CreateFixedCapAssetParams,
3838
CreateVariableCapAssetParams,
39-
ExportAVAXParams,
4039
ExportParams,
4140
ExportKeyParams,
4241
GetAllBalancesParams,
@@ -46,7 +45,6 @@ import {
4645
GetTxParams,
4746
GetTxStatusParams,
4847
GetUTXOsParams,
49-
ImportAVAXParams,
5048
ImportParams,
5149
ImportKeyParams,
5250
ListAddressesParams,
@@ -579,7 +577,7 @@ export class AVMAPI extends JRPCAPI {
579577
/**
580578
* Send ANT (Avalanche Native Token) assets including AVAX from the X-Chain to an account on the P-Chain or C-Chain.
581579
*
582-
* After calling this method, you must call the P-Chain's `importAVAX` or the C-Chain’s `import` method to complete the transfer.
580+
* After calling this method, you must call the P-Chain's `import` or the C-Chain’s `import` method to complete the transfer.
583581
*
584582
* @param username The Keystore user that controls the P-Chain or C-Chain account specified in `to`
585583
* @param password The password of the Keystore user
@@ -610,37 +608,6 @@ export class AVMAPI extends JRPCAPI {
610608
return response.data.result.txID
611609
}
612610

613-
/**
614-
* Send AVAX from the X-Chain to an account on the P-Chain or C-Chain.
615-
*
616-
* After calling this method, you must call the P-Chain’s or C-Chain's importAVAX method to complete the transfer.
617-
*
618-
* @param username The Keystore user that controls the P-Chain account specified in `to`
619-
* @param password The password of the Keystore user
620-
* @param to The account on the P-Chain or C-Chain to send the AVAX to.
621-
* @param amount Amount of AVAX to export as a {@link https://github.com/indutny/bn.js/|BN}
622-
*
623-
* @returns String representing the transaction id
624-
*/
625-
exportAVAX = async (
626-
username: string,
627-
password: string,
628-
to: string,
629-
amount: BN
630-
): Promise<string> => {
631-
const params: ExportAVAXParams = {
632-
to,
633-
amount: amount,
634-
username,
635-
password
636-
}
637-
const response: RequestResponseData = await this.callMethod(
638-
"avm.exportAVAX",
639-
params
640-
)
641-
return response.data.result.txID
642-
}
643-
644611
/**
645612
* Send ANT (Avalanche Native Token) assets including AVAX from an account on the P-Chain or C-Chain to an address on the X-Chain. This transaction
646613
* must be signed with the key of the account that the asset is sent from and which pays
@@ -673,36 +640,6 @@ export class AVMAPI extends JRPCAPI {
673640
return response.data.result.txID
674641
}
675642

676-
/**
677-
* Finalize a transfer of AVAX from the P-Chain to the X-Chain.
678-
*
679-
* Before this method is called, you must call the P-Chain’s `exportAVAX` method to initiate the transfer.
680-
* @param username The Keystore user that controls the address specified in `to`
681-
* @param password The password of the Keystore user
682-
* @param to The address the AVAX is sent to. This must be the same as the to argument in the corresponding call to the P-Chain’s exportAVAX, except that the prepended X- should be included in this argument
683-
* @param sourceChain Chain the funds are coming from.
684-
*
685-
* @returns String representing the transaction id
686-
*/
687-
importAVAX = async (
688-
username: string,
689-
password: string,
690-
to: string,
691-
sourceChain: string
692-
): Promise<string> => {
693-
const params: ImportAVAXParams = {
694-
to,
695-
sourceChain,
696-
username,
697-
password
698-
}
699-
const response: RequestResponseData = await this.callMethod(
700-
"avm.importAVAX",
701-
params
702-
)
703-
return response.data.result.txID
704-
}
705-
706643
/**
707644
* Lists all the addresses under a user.
708645
*

src/apis/avm/interfaces.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,11 @@ export interface ExportParams extends CredsInterface {
5757
assetID: string
5858
}
5959

60-
export interface ExportAVAXParams extends CredsInterface {
61-
to: string
62-
amount: BN
63-
}
64-
6560
export interface ImportParams extends CredsInterface {
6661
to: string
6762
sourceChain: string
6863
}
6964

70-
export interface ImportAVAXParams extends CredsInterface {
71-
to: string
72-
sourceChain: string
73-
}
74-
7565
export interface ListAddressesParams extends CredsInterface {}
7666

7767
export interface GetAllBalancesParams {

0 commit comments

Comments
 (0)